Class: AqumulateAPI::Advisor

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

Constant Summary collapse

ATTR_MAP =
{
    user_id: 'UserId',
    password: 'Password',
    first_name: 'FirstName',
    last_name: 'LastName',
    email: 'Email',
    phone: 'Phone',
    ssn: 'SSN',
    address_1: 'Address1',
    address_2: 'Address2',
    city: 'City',
    state: 'StateProvidence',
    zip: 'ZipCode',
    country: 'Country'
}

Constants inherited from Entity

Entity::SOURCE_ASSOCIATIONS

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

#address_1Object

Returns the value of attribute address_1.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def address_1
  @address_1
end

#address_2Object

Returns the value of attribute address_2.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def address_2
  @address_2
end

#cityObject

Returns the value of attribute city.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def city
  @city
end

#countryObject

Returns the value of attribute country.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def country
  @country
end

#emailObject

Returns the value of attribute email.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def last_name
  @last_name
end

#passwordObject

Returns the value of attribute password.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def password
  @password
end

#persistedObject

Returns the value of attribute persisted.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def persisted
  @persisted
end

#phoneObject

Returns the value of attribute phone.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def phone
  @phone
end

#ssnObject

Returns the value of attribute ssn.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def ssn
  @ssn
end

#stateObject

Returns the value of attribute state.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def state
  @state
end

#user_idObject

Returns the value of attribute user_id.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def user_id
  @user_id
end

#zipObject

Returns the value of attribute zip.



20
21
22
# File 'lib/aqumulate_api/entities/advisor.rb', line 20

def zip
  @zip
end

Class Method Details

.allObject



33
34
35
36
37
# File 'lib/aqumulate_api/entities/advisor.rb', line 33

def self.all
  response = AggAdvisor.get_advisors
  return [] unless response.has_key?('AdvisorList')
  response['AdvisorList'].map { |source| from_source(source) }
end

.find(user_id) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/aqumulate_api/entities/advisor.rb', line 23

def self.find(user_id)
  response = AggAdvisor.get_advisor_by_id({ 'UserId' => user_id })
  AqumulateAPI.session.check_raise_request_error(response)

  advisor = from_source(response)
  advisor.user_id = user_id

  return advisor
end

Instance Method Details

#accounts(fi_id = nil) ⇒ Object



56
57
58
# File 'lib/aqumulate_api/entities/advisor.rb', line 56

def accounts(fi_id = nil)
  Account.fetch(self, fi_id)
end

#add_account(fi_id, login_parameters, fetch_parameters) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/aqumulate_api/entities/advisor.rb', line 60

def (fi_id, , fetch_parameters)
  AggAccount.(
      {
          'SessionId' => session_id,
          'FIId' => fi_id,
          'FIType' => 'Advisor',
          'FIFetchParamList' => fetch_parameters,
          'ParameterList' => 
      }
  )
end

#destroyObject



51
52
53
54
# File 'lib/aqumulate_api/entities/advisor.rb', line 51

def destroy
  AggAdvisor.delete_advisor({ 'UserID' => user_id })
  return true
end

#saveObject



43
44
45
46
47
48
49
# File 'lib/aqumulate_api/entities/advisor.rb', line 43

def save
  if !persisted
    create
  else
    update
  end
end

#session_id(password = self.password) ⇒ Object



39
40
41
# File 'lib/aqumulate_api/entities/advisor.rb', line 39

def session_id(password = self.password)
  @session_id ||= AggAdvisor.advisor_sign_on('UserId' => user_id, 'Password' => password)['SessionId']
end