Class: Outreach::Prospect

Inherits:
Object
  • Object
show all
Extended by:
Model
Defined in:
lib/outreach-ruby/prospect.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Prospect

Returns a new instance of Prospect.



9
10
11
12
13
14
15
16
# File 'lib/outreach-ruby/prospect.rb', line 9

def initialize(attrs)
  @id = attrs['id']
  @first_name = attrs['first_name']
  @last_name = attrs['last_name']
  @emails = attrs['emails']
  @owner_id = attrs['owner_id']
  @response = attrs['response']
end

Instance Attribute Details

#emailsObject

Returns the value of attribute emails.



7
8
9
# File 'lib/outreach-ruby/prospect.rb', line 7

def emails
  @emails
end

#first_nameObject

Returns the value of attribute first_name.



7
8
9
# File 'lib/outreach-ruby/prospect.rb', line 7

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/outreach-ruby/prospect.rb', line 7

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



7
8
9
# File 'lib/outreach-ruby/prospect.rb', line 7

def last_name
  @last_name
end

#owner_idObject

Returns the value of attribute owner_id.



7
8
9
# File 'lib/outreach-ruby/prospect.rb', line 7

def owner_id
  @owner_id
end

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/outreach-ruby/prospect.rb', line 7

def response
  @response
end

Class Method Details

.build_from_attributes_hash(data) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/outreach-ruby/prospect.rb', line 18

def self.build_from_attributes_hash(data)
  result = {}
  result['first_name'] = nested_hash_value(
    data,
    %w[attributes firstName]
  )
  result['last_name'] = nested_hash_value(
    data,
    %w[attributes lastName]
  )
  result['emails'] = nested_hash_value(
    data,
    %w[attributes emails]
  )
  result['id'] = data['id']
  result['owner_id'] = nested_hash_value(
    data,
    %w[relationships owner data id]
  )
  result['response'] = data
  new(result)
end