lib/nubank_sdk/account.rb in nubank_sdk-0.6.1 vs lib/nubank_sdk/account.rb in nubank_sdk-0.7.0

- old
+ new

@@ -1,8 +1,11 @@ # frozen_string_literal: true module NubankSdk + # + # Returns the account statement + # class Account # # Returns the account statement # # @param [NubankSdk::Client::HTTPS] connection @@ -24,10 +27,28 @@ 'variables': {}, 'query': '{viewer {savingsAccount {currentSavingsBalance {netAmount}}}}' } ) - data = NubankSdk::Client.get_body(response) + data = Client.get_body(response) data[:data][:viewer][:savingsAccount][:currentSavingsBalance][:netAmount] + end + + # + # Returns the account feed + # + # @return [Array<Hash>] + def feed + query_url = @api_routes.entrypoint(path: :ssl, entrypoint: :query) + + response = @connection.post( + query_url, { + 'variables': {}, + 'query': Utils.read_graphql_query('account', 'feed') + } + ) + + data = Client.get_body(response) + data[:data][:viewer][:savingsAccount][:feed] end end end