Class: Outreach::Prospect
- Inherits:
-
Object
- Object
- Outreach::Prospect
- Defined in:
- lib/outreach/prospect.rb
Instance Attribute Summary collapse
-
#company ⇒ Object
Returns the value of attribute company.
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#tags ⇒ Object
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Prospect
constructor
A new instance of Prospect.
Constructor Details
#initialize(attrs) ⇒ Prospect
Returns a new instance of Prospect.
5 6 7 8 9 10 11 12 |
# File 'lib/outreach/prospect.rb', line 5 def initialize(attrs) @id = attrs['id'] @first_name = attrs['first_name'] @last_name = attrs['last_name'] @company = attrs['company'] @contact = attrs['contact'] @tags = attrs['tags'] end |
Instance Attribute Details
#company ⇒ Object
Returns the value of attribute company.
3 4 5 |
# File 'lib/outreach/prospect.rb', line 3 def company @company end |
#contact ⇒ Object
Returns the value of attribute contact.
3 4 5 |
# File 'lib/outreach/prospect.rb', line 3 def contact @contact end |
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/outreach/prospect.rb', line 3 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/outreach/prospect.rb', line 3 def id @id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/outreach/prospect.rb', line 3 def last_name @last_name end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/outreach/prospect.rb', line 3 def @tags end |
Class Method Details
.build_from_attributes_hash(attrs) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/outreach/prospect.rb', line 14 def self.build_from_attributes_hash(attrs) result = {} result['first_name'] = nested_hash_value(attrs, ['attributes', 'personal', 'name', 'first']) result['last_name'] = nested_hash_value(attrs, ['attributes', 'personal', 'name', 'last']) result['company'] = to_ostruct(attrs['attributes'].fetch('company', {})) result['contact'] = to_ostruct(attrs['attributes'].fetch('contact', {})) result['tags'] = nested_hash_value(attrs, ['attributes', 'metadata', 'tags']) result['id'] = attrs['id'] new(result) end |