Class: AqumulateAPI::Account

Inherits:
Entity
  • Object
show all
Defined in:
lib/aqumulate_api/entities/account.rb

Constant Summary collapse

ATTR_MAP =
{
    id: 'AcctId',
    login_account_id: 'FILoginAcctId',
    added_by: 'AccountAddedBy',
    financial_institution_id: 'FIId',
    financial_institution_name: 'FIName',
    account_type: 'AccountType',
    account_type_extended: 'ExtendedAccountType',
    nick_name: 'NickNameAtFI',
    update_error_code: 'UpdateErrorCode',
    retirement_status: 'RetirementStatus',
    instrument: 'Instrument',
    ownership: 'AccountOwnership',
    adv_access: 'AdvAccess',
    tracking_code: 'TrackingCode',
    last_update_status_code: 'LastUpdateStatusCode',
    last_update_status_msg: 'LastUpdateStatusMsg',
    last_update_status_msg_fi: 'LastUpdateStatusMessageAtFI',
    last_update_attempt: 'LastUpdateAttempt',
    last_update: 'LastSuccessfulUpdate'
}
SOURCE_ASSOCIATIONS =
[
    { key: 'AccountBalances', class: AccountBalance, attr: :account_balances },
    { key: 'Positions', class: Position, attr: :positions }
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

from_source, #initialize

Constructor Details

This class inherits a constructor from AqumulateAPI::Entity

Instance Attribute Details

#account_balancesObject

Returns the value of attribute account_balances.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def 
  @account_balances
end

#account_typeObject

Returns the value of attribute account_type.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def 
  @account_type
end

#account_type_extendedObject

Returns the value of attribute account_type_extended.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def 
  @account_type_extended
end

#added_byObject

Returns the value of attribute added_by.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def added_by
  @added_by
end

#adv_accessObject

Returns the value of attribute adv_access.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def adv_access
  @adv_access
end

#financial_institution_idObject

Returns the value of attribute financial_institution_id.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def financial_institution_id
  @financial_institution_id
end

#financial_institution_nameObject

Returns the value of attribute financial_institution_name.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def financial_institution_name
  @financial_institution_name
end

#idObject

Returns the value of attribute id.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def id
  @id
end

#instrumentObject

Returns the value of attribute instrument.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def instrument
  @instrument
end

#last_updateObject

Returns the value of attribute last_update.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def last_update
  @last_update
end

#last_update_attemptObject

Returns the value of attribute last_update_attempt.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def last_update_attempt
  @last_update_attempt
end

#last_update_status_codeObject

Returns the value of attribute last_update_status_code.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def last_update_status_code
  @last_update_status_code
end

#last_update_status_msgObject

Returns the value of attribute last_update_status_msg.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def last_update_status_msg
  @last_update_status_msg
end

#last_update_status_msg_fiObject

Returns the value of attribute last_update_status_msg_fi.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def last_update_status_msg_fi
  @last_update_status_msg_fi
end

#login_account_idObject

Returns the value of attribute login_account_id.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def 
  @login_account_id
end

#nick_nameObject

Returns the value of attribute nick_name.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def nick_name
  @nick_name
end

#ownershipObject

Returns the value of attribute ownership.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def ownership
  @ownership
end

#positionsObject

Returns the value of attribute positions.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def positions
  @positions
end

#retirement_statusObject

Returns the value of attribute retirement_status.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def retirement_status
  @retirement_status
end

#tracking_codeObject

Returns the value of attribute tracking_code.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def tracking_code
  @tracking_code
end

#update_error_codeObject

Returns the value of attribute update_error_code.



31
32
33
# File 'lib/aqumulate_api/entities/account.rb', line 31

def update_error_code
  @update_error_code
end

Class Method Details

.fetch(advisor, fi_id = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/aqumulate_api/entities/account.rb', line 37

def self.fetch(advisor, fi_id = nil)
  body = { 'SessionId' => advisor.session_id }

  if fi_id.nil?
    response = AggAccount.(body)
  else
    body['FIId'] = fi_id
    response = AggAccount.(body)
  end
  return [] unless response.has_key?('Accounts')

  response['Accounts'].map { |source| from_source(source) }
end

Instance Method Details

#financial_institutionObject



59
60
61
# File 'lib/aqumulate_api/entities/account.rb', line 59

def financial_institution
  @financial_institution ||= FinancialInstitution.find(financial_institution_id)
end