Class: EML::UK::Responses::Card::Transaction

Inherits:
EML::UK::Response show all
Extended by:
T::Sig
Defined in:
lib/eml/uk/responses/card/transaction.rb

Instance Method Summary collapse

Methods inherited from Response

#body, #error, field, #headers, #http_status, #success?, #url

Constructor Details

#initialize(response, id: nil) ⇒ Transaction

Returns a new instance of Transaction.



14
15
16
17
18
19
20
21
# File 'lib/eml/uk/responses/card/transaction.rb', line 14

def initialize(response, id: nil)
  super

  @transactions = T.let(
    nil,
    T.nilable(T::Array[::EML::UK::Models::Transaction])
  )
end

Instance Method Details

#transactionsObject



24
25
26
27
28
29
# File 'lib/eml/uk/responses/card/transaction.rb', line 24

def transactions
  @transactions ||= body["transactions"].
    each_with_object([]) do |transaction, array|
      array << ::EML::UK::Models::Transaction.new(transaction)
    end
end