class PipeRocket::Person
Attributes
email[RW]
id[RW]
organization[RW]
phone[RW]
Public Class Methods
key_field_hash()
click to toggle source
Returns hash {custom_field_key: PipeRocket::Field
object}
# File lib/pipe_rocket/person.rb, line 6 def self.key_field_hash @@key_field_hash ||= Pipedrive.person_fields.key_field_hash end
new(hash)
click to toggle source
Calls superclass method
PipeRocket::Entity::new
# 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