Class: WhatsAppCloudApi::Interactive
- Defined in:
- lib/whats_app_cloud_api/models/interactive.rb
Overview
Interactive Model.
Instance Attribute Summary collapse
-
#action ⇒ Action
Action you want the user to perform after reading the message.
-
#body ⇒ Body
The body of the message.
-
#footer ⇒ Footer
The footer of the message.
-
#header ⇒ Header
Header content displayed on top of a message.
-
#type ⇒ InteractiveTypeEnum
The type of interactive message you want to send.
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(action = nil, body = nil, type = nil, footer = nil, header = nil) ⇒ Interactive
constructor
A new instance of Interactive.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(action = nil, body = nil, type = nil, footer = nil, header = nil) ⇒ Interactive
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 56 def initialize(action = nil, body = nil, type = nil, = nil, header = nil) @action = action unless action == SKIP @body = body unless body == SKIP = unless == SKIP @header = header unless header == SKIP @type = type unless type == SKIP end |
Instance Attribute Details
#action ⇒ Action
Action you want the user to perform after reading the message.
14 15 16 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 14 def action @action end |
#body ⇒ Body
The body of the message. Emojis and markdown are supported.
18 19 20 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 18 def body @body end |
#footer ⇒ Footer
The footer of the message. Emojis and markdown are supported.
22 23 24 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 22 def end |
#header ⇒ Header
Header content displayed on top of a message.
26 27 28 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 26 def header @header end |
#type ⇒ InteractiveTypeEnum
The type of interactive message you want to send.
30 31 32 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 30 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. action = Action.from_hash(hash['action']) if hash['action'] body = Body.from_hash(hash['body']) if hash['body'] type = hash.key?('type') ? hash['type'] : SKIP = .from_hash(hash['footer']) if hash['footer'] header = Header.from_hash(hash['header']) if hash['header'] # Create object from extracted values. Interactive.new(action, body, type, , header) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['action'] = 'action' @_hash['body'] = 'body' @_hash['footer'] = 'footer' @_hash['header'] = 'header' @_hash['type'] = 'type' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 52 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 |
# File 'lib/whats_app_cloud_api/models/interactive.rb', line 44 def optionals %w[ footer header ] end |