Class: PipeRocket::Person
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.
Class Method Summary collapse
-
.key_field_hash ⇒ Object
Returns hash PipeRocket::Field object.
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.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pipe_rocket/person.rb', line 10 def initialize(hash) super(hash.except(*Person.key_field_hash.keys)) @email = hash['email'].first['value'] if hash['email'] @phone = hash['phone'].first['value'] if hash['phone'] @id = hash['value'] if hash['value'].present? assign_custom_fields(Person.key_field_hash, hash) org_id = hash['org_id'] if org_id @organization = case org_id when Integer Pipedrive.organizations.find(org_id) when Hash Organization.new(org_id) else nil end end end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/pipe_rocket/person.rb', line 3 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/pipe_rocket/person.rb', line 3 def id @id end |
#organization ⇒ Object
Returns the value of attribute organization.
3 4 5 |
# File 'lib/pipe_rocket/person.rb', line 3 def organization @organization end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/pipe_rocket/person.rb', line 3 def phone @phone end |
Class Method Details
.key_field_hash ⇒ Object
Returns hash PipeRocket::Field object
6 7 8 |
# File 'lib/pipe_rocket/person.rb', line 6 def self.key_field_hash @@key_field_hash ||= Pipedrive.person_fields.key_field_hash end |