Skip to content

Commit

Permalink
chore: use ExConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
maximemenager committed Jan 12, 2023
1 parent ae08299 commit fc072e3
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lib/chargebeex/time_machine/time_machine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,7 @@ defmodule Chargebeex.TimeMachine do
field :resources, map(), defualt: %{}
end

@moduledoc """
Struct that represent a Chargebee's API TimeMachine.
"""
def build(raw_data) do
attrs = %{
name: raw_data["name"],
time_travel_status: raw_data["time_travel_status"],
genesis_time: raw_data["genesis_time"],
destination_time: raw_data["destination_time"],
failure_code: raw_data["failure_code"],
failure_reason: raw_data["failure_reason"],
error_json: raw_data["error_json"],
object: raw_data["object"]
}

struct(__MODULE__, attrs)
end
use ExConstructor, :build

@doc """
Restart the time machine.
Expand Down

0 comments on commit fc072e3

Please sign in to comment.