Class: WhatsAppCloudApi::Row
- Defined in:
- lib/whats_app_cloud_api/models/row.rb
Overview
Row Model.
Instance Attribute Summary collapse
-
#description ⇒ String
TODO: Write general description for this method.
-
#id ⇒ String
TODO: Write general description for this method.
-
#title ⇒ String
TODO: Write general description for this method.
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(id = nil, title = nil, description = nil) ⇒ Row
constructor
A new instance of Row.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
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
#description ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/whats_app_cloud_api/models/row.rb', line 22 def description @description end |
#id ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/whats_app_cloud_api/models/row.rb', line 14 def id @id end |
#title ⇒ String
TODO: Write general description for this method
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 |
.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/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
#nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/whats_app_cloud_api/models/row.rb', line 41 def nullables [] end |
#optionals ⇒ Object
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 |