Class: PipedriveJetrockets::Person
- Defined in:
- lib/pipedrive_jetrockets/person.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#phone ⇒ Object
Returns the value of attribute phone.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Person
constructor
A new instance of Person.
Methods inherited from Entity
#assign_custom_fields, #transform_field_name
Constructor Details
#initialize(hash) ⇒ Person
Returns a new instance of Person.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pipedrive_jetrockets/person.rb', line 4 def initialize(hash) @@key_name_hash ||= Pipedrive.person_fields.key_field_hash super(hash.except(*@@key_name_hash.keys)) @email = hash['email'].first['value'] if hash['email'] @phone = hash['phone'].first['value'] if hash['phone'] org_id = hash['org_id'] if org_id if org_id.kind_of? Integer @organization = Pipedrive.organizations.find(org_id) else @organization = Organization.new(org_id) end end @id = hash['value'] if hash['value'].present? assign_custom_fields(@@key_name_hash, hash) end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/pipedrive_jetrockets/person.rb', line 3 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/pipedrive_jetrockets/person.rb', line 3 def id @id end |
#organization ⇒ Object
Returns the value of attribute organization.
3 4 5 |
# File 'lib/pipedrive_jetrockets/person.rb', line 3 def organization @organization end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/pipedrive_jetrockets/person.rb', line 3 def phone @phone end |