Class: WhatsAppCloudApi::Org
- Defined in:
- lib/whats_app_cloud_api/models/org.rb
Overview
Org Model.
Instance Attribute Summary collapse
-
#company ⇒ String
Name of the contact’s company.
-
#department ⇒ String
Name of the contact’s department.
-
#title ⇒ String
Contact’s business title.
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(company = nil, department = nil, title = nil) ⇒ Org
constructor
A new instance of Org.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(company = nil, department = nil, title = nil) ⇒ Org
Returns a new instance of Org.
47 48 49 50 51 52 53 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 47 def initialize(company = nil, department = nil, title = nil) @company = company unless company == SKIP @department = department unless department == SKIP @title = title unless title == SKIP end |
Instance Attribute Details
#company ⇒ String
Name of the contact’s company.
14 15 16 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 14 def company @company end |
#department ⇒ String
Name of the contact’s department.
18 19 20 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 18 def department @department end |
#title ⇒ String
Contact’s business title.
22 23 24 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 22 def title @title end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. company = hash.key?('company') ? hash['company'] : SKIP department = hash.key?('department') ? hash['department'] : SKIP title = hash.key?('title') ? hash['title'] : SKIP # Create object from extracted values. Org.new(company, department, title) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['company'] = 'company' @_hash['department'] = 'department' @_hash['title'] = 'title' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 43 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/whats_app_cloud_api/models/org.rb', line 34 def optionals %w[ company department title ] end |