Class: NubankSdk::Account
- Inherits:
-
Object
- Object
- NubankSdk::Account
- Defined in:
- lib/nubank_sdk/account.rb
Overview
Returns the account statement
Instance Method Summary collapse
-
#balance ⇒ Float
Returns the account balance.
-
#feed ⇒ Array<Hash>
Returns the account feed.
-
#initialize(connection:, api_routes:) ⇒ Account
constructor
Returns the account statement.
Constructor Details
#initialize(connection:, api_routes:) ⇒ Account
Returns the account statement
15 16 17 18 |
# File 'lib/nubank_sdk/account.rb', line 15 def initialize(connection:, api_routes:) @connection = connection @api_routes = api_routes end |
Instance Method Details
#balance ⇒ Float
Returns the account balance
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/nubank_sdk/account.rb', line 24 def balance query_url = @api_routes.entrypoint(path: :ssl, entrypoint: :query) response = @connection.post( query_url, { 'variables': {}, 'query': Graphql::Account::BALANCE } ) data = Client.get_body(response) data[:data][:viewer][:savingsAccount][:currentSavingsBalance][:netAmount] end |
#feed ⇒ Array<Hash>
Returns the account feed
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/nubank_sdk/account.rb', line 42 def feed query_url = @api_routes.entrypoint(path: :ssl, entrypoint: :query) response = @connection.post( query_url, { 'variables': {}, 'query': Graphql::Account::FEED } ) data = Client.get_body(response) data[:data][:viewer][:savingsAccount][:feed] end |