Class: WhatsAppCloudApi::Row

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

Overview

Row Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, title = nil, description = nil) ⇒ Row

Returns a new instance of Row.



45
46
47
48
49
50
51
# File 'lib/whats_app_cloud_api/models/row.rb', line 45

def initialize(id = nil,
               title = nil,
               description = nil)
  @id = id unless id == SKIP
  @title = title unless title == SKIP
  @description = description unless description == SKIP
end

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/whats_app_cloud_api/models/row.rb', line 22

def description
  @description
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


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

def id
  @id
end

#titleString

TODO: Write general description for this method

Returns:

  • (String)


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

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/whats_app_cloud_api/models/row.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  id = hash.key?('id') ? hash['id'] : SKIP
  title = hash.key?('title') ? hash['title'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP

  # Create object from extracted values.

  Row.new(id,
          title,
          description)
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/row.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['title'] = 'title'
  @_hash['description'] = 'description'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



41
42
43
# File 'lib/whats_app_cloud_api/models/row.rb', line 41

def nullables
  []
end

#optionalsObject

An array for optional fields



34
35
36
37
38
# File 'lib/whats_app_cloud_api/models/row.rb', line 34

def optionals
  %w[
    description
  ]
end