Class: Em::Nordnet::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/em-nordnet/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Account

Returns a new instance of Account.



16
17
18
19
20
# File 'lib/em-nordnet/account.rb', line 16

def initialize attributes={}
  self.id       = attributes[:id]
  self.alias    = attributes[:alias]
  self.default  = attributes[:default]
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



4
5
6
# File 'lib/em-nordnet/account.rb', line 4

def alias
  @alias
end

#defaultObject

Returns the value of attribute default.



4
5
6
# File 'lib/em-nordnet/account.rb', line 4

def default
  @default
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/em-nordnet/account.rb', line 4

def id
  @id
end

Class Method Details

.allObject



7
8
9
# File 'lib/em-nordnet/account.rb', line 7

def all
  @accounts ||= Nordnet.api.accounts.map { |attrs| new attrs }
end

.defaultObject



11
12
13
# File 'lib/em-nordnet/account.rb', line 11

def default
  all.select(&:default).first
end

Instance Method Details

#ordersObject



22
23
24
# File 'lib/em-nordnet/account.rb', line 22

def orders
  Order.all id
end