Class: FioAPI::ListResponseDeserializer

Inherits:
HTTParty::Parser
  • Object
show all
Defined in:
lib/base/deserializers/list_response_deserializer.rb

Overview

ListResponseDeserializer

Deserializer responsible for response json deserializing. Should construct object with account and transactions attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accountObject

Returns the value of attribute account.



8
9
10
# File 'lib/base/deserializers/list_response_deserializer.rb', line 8

def 
  @account
end

#transactionsObject

Returns the value of attribute transactions.



8
9
10
# File 'lib/base/deserializers/list_response_deserializer.rb', line 8

def transactions
  @transactions
end

Instance Method Details

#deserialize(json) ⇒ Object

Deserialize json

Parameters:

hash

Hash returned from list request.

Returns:

New object with  and transactions attributes


28
29
30
31
32
33
34
# File 'lib/base/deserializers/list_response_deserializer.rb', line 28

def deserialize(json)
  raise FioAPI::InvalidJsonResponse.new(json) if json.is_a?(String)

  self. = (json.try_path('accountStatement', 'info'))
  self.transactions = deserialize_transactions(json.try_path('accountStatement', 'transactionList', 'transaction'))
  self
end

#parseObject

Parse json

Returns:

Should return new deserialized object


15
16
17
# File 'lib/base/deserializers/list_response_deserializer.rb', line 15

def parse
  deserialize super
end