Class: IGMarkets::DealingPlatform::AccountMethods
- Inherits:
-
Object
- Object
- IGMarkets::DealingPlatform::AccountMethods
- Defined in:
- lib/ig_markets/dealing_platform/account_methods.rb
Overview
Provides methods for working with the logged in account. Returned by #account.
Instance Method Summary collapse
-
#activities(options) ⇒ Array<Activity>
Returns activities for this account in the specified time range.
-
#all ⇒ Array<Account>
Returns all accounts associated with the current IG Markets login.
-
#initialize(dealing_platform) ⇒ AccountMethods
constructor
Initializes this helper class with the specified dealing platform.
-
#transactions(options) ⇒ Array<Transaction>
Returns transactions for this account in the specified time range.
Constructor Details
#initialize(dealing_platform) ⇒ AccountMethods
Initializes this helper class with the specified dealing platform.
8 9 10 |
# File 'lib/ig_markets/dealing_platform/account_methods.rb', line 8 def initialize(dealing_platform) @dealing_platform = WeakRef.new dealing_platform end |
Instance Method Details
#activities(options) ⇒ Array<Activity>
Returns activities for this account in the specified time range.
28 29 30 |
# File 'lib/ig_markets/dealing_platform/account_methods.rb', line 28 def activities() activities_request build_url_parameters().merge(detailed: true) end |
#all ⇒ Array<Account>
Returns all accounts associated with the current IG Markets login.
15 16 17 18 19 |
# File 'lib/ig_markets/dealing_platform/account_methods.rb', line 15 def all result = @dealing_platform.session.get('accounts').fetch :accounts @dealing_platform.instantiate_models Account, result end |
#transactions(options) ⇒ Array<Transaction>
Returns transactions for this account in the specified time range.
41 42 43 44 45 46 47 48 49 |
# File 'lib/ig_markets/dealing_platform/account_methods.rb', line 41 def transactions() [:type] ||= :all unless %i[all all_deal deposit withdrawal].include? [:type] raise ArgumentError, "invalid transaction type: #{[:type]}" end tranaactions_request build_url_parameters() end |