Class: CreditGateway::Transaction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/credit_gateway/transaction.rb

Class Method Summary collapse

Methods inherited from BaseModel

#as_json, attribute_aliases, attributes, #initialize, key_transformer

Constructor Details

This class inherits a constructor from CreditGateway::BaseModel

Class Method Details

.build(json:) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/credit_gateway/transaction.rb', line 13

def self.build(json:)
  super.tap do |record|
    record.amount = Amount.build(json: (record.amount || {}))
    record.booking_date_time = Time.parse(record.booking_date_time) if record.booking_date_time
    record.value_date_time = Time.parse(record.value_date_time) if record.value_date_time
  end
end