Class: Tastytrade::Client
- Inherits:
-
Object
- Object
- Tastytrade::Client
- Includes:
- Authentication, Error
- Defined in:
- lib/tastytrade/client.rb
Instance Attribute Summary
Attributes included from Authentication
#access_token, #access_token_expires_at, #authorization_code, #client_id, #redirect_uri, #refresh_token, #secret
Instance Method Summary collapse
- #get_account(account_number:) ⇒ Object
- #get_customer ⇒ Object
- #get_total_fees(account_number:, **options) ⇒ Object
- #get_transaction(account_number:, id:) ⇒ Object
-
#initialize(**args) ⇒ Client
constructor
A new instance of Client.
- #list_customer_accounts ⇒ Object
- #list_transactions(account_number:, **options) ⇒ Object
Methods included from Error
Methods included from Authentication
#default_headers, #refresh_access_token, #request_access_token
Methods included from Util
Constructor Details
#initialize(**args) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 23 |
# File 'lib/tastytrade/client.rb', line 16 def initialize(**args) @access_token = args[:access_token] @refresh_token = args[:refresh_token] @access_token_expires_at = args[:access_token_expires_at] @client_id = args[:client_id] || raise_error('client_id is required!') @secret = args[:secret] || raise_error('secret is required!') @redirect_uri = args[:redirect_uri] || raise_error('redirect_uri is required!') end |
Instance Method Details
#get_account(account_number:) ⇒ Object
45 46 47 |
# File 'lib/tastytrade/client.rb', line 45 def get_account(account_number:) Operations::CustomerAccountInfo::GetAccount.new(self).call(account_number:) end |
#get_customer ⇒ Object
37 38 39 |
# File 'lib/tastytrade/client.rb', line 37 def get_customer Operations::CustomerAccountInfo::GetCustomer.new(self).call end |
#get_total_fees(account_number:, **options) ⇒ Object
25 26 27 |
# File 'lib/tastytrade/client.rb', line 25 def get_total_fees(account_number:, **) Operations::AccountTransactions::GetTotalFees.new(self).call(account_number:, **) end |
#get_transaction(account_number:, id:) ⇒ Object
29 30 31 |
# File 'lib/tastytrade/client.rb', line 29 def get_transaction(account_number:, id:) Operations::AccountTransactions::GetTransaction.new(self).call(account_number:, id:) end |
#list_customer_accounts ⇒ Object
41 42 43 |
# File 'lib/tastytrade/client.rb', line 41 def list_customer_accounts Operations::CustomerAccountInfo::ListCustomerAccounts.new(self).call end |
#list_transactions(account_number:, **options) ⇒ Object
33 34 35 |
# File 'lib/tastytrade/client.rb', line 33 def list_transactions(account_number:, **) Operations::AccountTransactions::ListTransactions.new(self).call(account_number:, **) end |