Class: SchwabRb::DataObjects::AccountNumbers

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/schwab_rb/data_objects/account_numbers.rb

Defined Under Namespace

Classes: AccountNumber

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ AccountNumbers

Returns a new instance of AccountNumbers.



15
16
17
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 15

def initialize(data)
  @accounts = data.map { || AccountNumber.new() }
end

Instance Attribute Details

#accountsObject (readonly)

Returns the value of attribute accounts.



7
8
9
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 7

def accounts
  @accounts
end

Class Method Details

.build(data) ⇒ Object



10
11
12
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 10

def build(data)
  new(data)
end

Instance Method Details

#account_numbersObject



32
33
34
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 32

def 
  @accounts.map(&:account_number)
end

#each(&block) ⇒ Object



48
49
50
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 48

def each(&block)
  @accounts.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 44

def empty?
  @accounts.empty?
end

#find_by_account_number(account_number) ⇒ Object



23
24
25
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 23

def ()
  @accounts.find { || . ==  }
end

#find_hash_value(account_number) ⇒ Object



27
28
29
30
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 27

def find_hash_value()
   = ()
  &.hash_value
end

#hash_valuesObject



36
37
38
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 36

def hash_values
  @accounts.map(&:hash_value)
end

#sizeObject



40
41
42
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 40

def size
  @accounts.size
end

#to_hObject



19
20
21
# File 'lib/schwab_rb/data_objects/account_numbers.rb', line 19

def to_h
  @accounts.map(&:to_h)
end