Class: Outreach::User
- Inherits:
-
Object
- Object
- Outreach::User
- Extended by:
- Model
- Defined in:
- lib/outreach-ruby/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#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.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(attrs) ⇒ User
Returns a new instance of User.
9 10 11 12 13 14 15 |
# File 'lib/outreach-ruby/user.rb', line 9 def initialize(attrs) @id = attrs['id'] @first_name = attrs['first_name'] @last_name = attrs['last_name'] @email = attrs['email'] @response = attrs['response'] end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
7 8 9 |
# File 'lib/outreach-ruby/user.rb', line 7 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
7 8 9 |
# File 'lib/outreach-ruby/user.rb', line 7 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/outreach-ruby/user.rb', line 7 def id @id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
7 8 9 |
# File 'lib/outreach-ruby/user.rb', line 7 def last_name @last_name end |
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/outreach-ruby/user.rb', line 7 def response @response end |
Class Method Details
.build_from_attributes_hash(data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/outreach-ruby/user.rb', line 17 def self.build_from_attributes_hash(data) result = {} result['id'] = data['id'] result['first_name'] = nested_hash_value( data, %w[attributes firstName] ) result['last_name'] = nested_hash_value( data, %w[attributes lastName] ) result['email'] = nested_hash_value( data, %w[attributes email] ) result['response'] = data new(result) end |