Class: FioAPI::ListResponseDeserializer
- Inherits:
-
HTTParty::Parser
- Object
- HTTParty::Parser
- FioAPI::ListResponseDeserializer
- 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
-
#account ⇒ Object
Returns the value of attribute account.
-
#transactions ⇒ Object
Returns the value of attribute transactions.
Instance Method Summary collapse
-
#deserialize(json) ⇒ Object
Deserialize json.
-
#parse ⇒ Object
Parse json.
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
8 9 10 |
# File 'lib/base/deserializers/list_response_deserializer.rb', line 8 def account @account end |
#transactions ⇒ Object
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 account 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.account = deserialize_account(json.try_path('accountStatement', 'info')) self.transactions = deserialize_transactions(json.try_path('accountStatement', 'transactionList', 'transaction')) self end |
#parse ⇒ Object
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 |