Class: WhatsAppCloudApi::Sticker
- Defined in:
- lib/whats_app_cloud_api/models/sticker.rb
Overview
Sticker Model.
Instance Attribute Summary collapse
-
#id ⇒ String
The media object ID.
-
#link ⇒ String
The protocol and URL of the media to be sent.
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(link = nil, id = nil) ⇒ Sticker
constructor
A new instance of Sticker.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(link = nil, id = nil) ⇒ Sticker
Returns a new instance of Sticker.
42 43 44 45 46 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 42 def initialize(link = nil, id = nil) @link = link unless link == SKIP @id = id unless id == SKIP end |
Instance Attribute Details
#id ⇒ String
The media object ID. Required when you are not using a link.
19 20 21 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 19 def id @id end |
#link ⇒ String
The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Required when you are not using an uploaded media ID.
15 16 17 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 15 def link @link end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 49 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. link = hash.key?('link') ? hash['link'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP # Create object from extracted values. Sticker.new(link, id) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['link'] = 'link' @_hash['id'] = 'id' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
38 39 40 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 38 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
30 31 32 33 34 35 |
# File 'lib/whats_app_cloud_api/models/sticker.rb', line 30 def optionals %w[ link id ] end |