lib/nubank_sdk/account.rb in nubank_sdk-0.7.0 vs lib/nubank_sdk/account.rb in nubank_sdk-0.7.1
- old
+ new
@@ -1,7 +1,9 @@
# frozen_string_literal: true
+require 'graphql/account'
+
module NubankSdk
#
# Returns the account statement
#
class Account
@@ -23,11 +25,11 @@
query_url = @api_routes.entrypoint(path: :ssl, entrypoint: :query)
response = @connection.post(
query_url, {
'variables': {},
- 'query': '{viewer {savingsAccount {currentSavingsBalance {netAmount}}}}'
+ 'query': Graphql::Account::BALANCE
}
)
data = Client.get_body(response)
data[:data][:viewer][:savingsAccount][:currentSavingsBalance][:netAmount]
@@ -41,10 +43,10 @@
query_url = @api_routes.entrypoint(path: :ssl, entrypoint: :query)
response = @connection.post(
query_url, {
'variables': {},
- 'query': Utils.read_graphql_query('account', 'feed')
+ 'query': Graphql::Account::FEED
}
)
data = Client.get_body(response)
data[:data][:viewer][:savingsAccount][:feed]