Class: Raas::NameEmailModel
- Defined in:
- lib/raas/models/name_email_model.rb
Overview
Represents a name and an email address
Instance Attribute Summary collapse
-
#email ⇒ String
An email address.
-
#first_name ⇒ String
A first name.
-
#last_name ⇒ String
A last name.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(email = nil, first_name = nil, last_name = nil) ⇒ NameEmailModel
constructor
A new instance of NameEmailModel.
Methods inherited from BaseModel
Constructor Details
#initialize(email = nil, first_name = nil, last_name = nil) ⇒ NameEmailModel
Returns a new instance of NameEmailModel.
28 29 30 31 32 33 34 |
# File 'lib/raas/models/name_email_model.rb', line 28 def initialize(email = nil, first_name = nil, last_name = nil) @email = email @first_name = first_name @last_name = last_name end |
Instance Attribute Details
#email ⇒ String
An email address
9 10 11 |
# File 'lib/raas/models/name_email_model.rb', line 9 def email @email end |
#first_name ⇒ String
A first name
13 14 15 |
# File 'lib/raas/models/name_email_model.rb', line 13 def first_name @first_name end |
#last_name ⇒ String
A last name
17 18 19 |
# File 'lib/raas/models/name_email_model.rb', line 17 def last_name @last_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/raas/models/name_email_model.rb', line 37 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. email = hash['email'] first_name = hash['firstName'] last_name = hash['lastName'] # Create object from extracted values. NameEmailModel.new(email, first_name, last_name) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 25 26 |
# File 'lib/raas/models/name_email_model.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['email'] = 'email' @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash end |