Class: WhatsAppCloudApi::Org

Inherits:
BaseModel show all
Defined in:
lib/whats_app_cloud_api/models/org.rb

Overview

Org Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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

#companyString

Name of the contact’s company.

Returns:

  • (String)


14
15
16
# File 'lib/whats_app_cloud_api/models/org.rb', line 14

def company
  @company
end

#departmentString

Name of the contact’s department.

Returns:

  • (String)


18
19
20
# File 'lib/whats_app_cloud_api/models/org.rb', line 18

def department
  @department
end

#titleString

Contact’s business title.

Returns:

  • (String)


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

.namesObject

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

#nullablesObject

An array for nullable fields



43
44
45
# File 'lib/whats_app_cloud_api/models/org.rb', line 43

def nullables
  []
end

#optionalsObject

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