Class: Zernio::WebhookPayloadMessageMetadata
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::WebhookPayloadMessageMetadata
- Defined in:
- lib/zernio-sdk/models/webhook_payload_message_metadata.rb
Overview
Interactive message metadata (present when message is a quick reply tap, postback button tap, or inline keyboard callback)
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#button_payload ⇒ Object
WhatsApp only.
-
#callback_data ⇒ Object
Callback data from an inline keyboard button tap (Telegram).
-
#contacts ⇒ Object
WhatsApp only.
-
#contacts_origin ⇒ Object
WhatsApp only.
-
#flow_response_data ⇒ Object
WhatsApp only.
-
#flow_response_json ⇒ Object
WhatsApp only.
-
#interactive_id ⇒ Object
WhatsApp only.
-
#interactive_type ⇒ Object
WhatsApp only.
-
#is_story_mention ⇒ Object
Instagram only.
-
#order ⇒ Object
Returns the value of attribute order.
-
#postback_payload ⇒ Object
Payload from a postback button tap (Facebook/Instagram Messenger).
-
#postback_title ⇒ Object
Title of the tapped postback button (Facebook/Instagram Messenger).
-
#quick_reply_payload ⇒ Object
Payload from a quick reply tap (Facebook/Instagram Messenger).
-
#referral ⇒ Object
Returns the value of attribute referral.
-
#referred_product ⇒ Object
Returns the value of attribute referred_product.
-
#story_reply ⇒ Object
Returns the value of attribute story_reply.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ WebhookPayloadMessageMetadata
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ WebhookPayloadMessageMetadata
Initializes the object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 147 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadMessageMetadata` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WebhookPayloadMessageMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'quick_reply_payload') self.quick_reply_payload = attributes[:'quick_reply_payload'] end if attributes.key?(:'postback_payload') self.postback_payload = attributes[:'postback_payload'] end if attributes.key?(:'postback_title') self.postback_title = attributes[:'postback_title'] end if attributes.key?(:'callback_data') self.callback_data = attributes[:'callback_data'] end if attributes.key?(:'interactive_type') self.interactive_type = attributes[:'interactive_type'] end if attributes.key?(:'interactive_id') self.interactive_id = attributes[:'interactive_id'] end if attributes.key?(:'button_payload') self. = attributes[:'button_payload'] end if attributes.key?(:'flow_response_json') self.flow_response_json = attributes[:'flow_response_json'] end if attributes.key?(:'flow_response_data') if (value = attributes[:'flow_response_data']).is_a?(Hash) self.flow_response_data = value end end if attributes.key?(:'order') self.order = attributes[:'order'] end if attributes.key?(:'referred_product') self.referred_product = attributes[:'referred_product'] end if attributes.key?(:'contacts') if (value = attributes[:'contacts']).is_a?(Array) self.contacts = value end end if attributes.key?(:'contacts_origin') self.contacts_origin = attributes[:'contacts_origin'] end if attributes.key?(:'story_reply') self.story_reply = attributes[:'story_reply'] end if attributes.key?(:'is_story_mention') self.is_story_mention = attributes[:'is_story_mention'] end if attributes.key?(:'referral') self.referral = attributes[:'referral'] end end |
Instance Attribute Details
#button_payload ⇒ Object
WhatsApp only. Payload attached to a tapped template button. Template buttons emit a plain button webhook (not an interactive reply), so interactiveType is empty while this field is populated.
38 39 40 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 38 def @button_payload end |
#callback_data ⇒ Object
Callback data from an inline keyboard button tap (Telegram).
29 30 31 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 29 def callback_data @callback_data end |
#contacts ⇒ Object
WhatsApp only. Contact cards the user shared, forwarded verbatim from Meta. Read contactsOrigin before treating any number here as the sender's own.
51 52 53 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 51 def contacts @contacts end |
#contacts_origin ⇒ Object
WhatsApp only. How the contact card was shared. contact_request means the user tapped a request_contact_info button, so the number is their own and consented. other means they picked a card from their address book: it may be anyone's, and must NOT be stored as the sender's identity. Omitted when Meta sends no origin.
54 55 56 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 54 def contacts_origin @contacts_origin end |
#flow_response_data ⇒ Object
WhatsApp only. Parsed Flow response JSON. Populated when flowResponseJson is valid JSON; otherwise omitted. Keys and value types depend on the specific Flow that was submitted.
44 45 46 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 44 def flow_response_data @flow_response_data end |
#flow_response_json ⇒ Object
WhatsApp only. Raw nfm_reply.response_json string returned by a Flow submission. Useful if you need the exact wire payload; for typed access use flowResponseData instead.
41 42 43 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 41 def flow_response_json @flow_response_json end |
#interactive_id ⇒ Object
WhatsApp only. The id of the tapped button or list row, matching the id you supplied when the message was sent. Not set for Flow responses.
35 36 37 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 35 def interactive_id @interactive_id end |
#interactive_type ⇒ Object
WhatsApp only. Which kind of interactive reply the user sent: button_reply (tap on an interactive button), list_reply (tap on a list row), or nfm_reply (a WhatsApp Flow submission).
32 33 34 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 32 def interactive_type @interactive_type end |
#is_story_mention ⇒ Object
Instagram only. True when the message was generated by an IG user mentioning the account in their own story (story_mention attachment type). Mutually exclusive in practice with storyReply.
59 60 61 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 59 def is_story_mention @is_story_mention end |
#order ⇒ Object
Returns the value of attribute order.
46 47 48 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 46 def order @order end |
#postback_payload ⇒ Object
Payload from a postback button tap (Facebook/Instagram Messenger).
23 24 25 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 23 def postback_payload @postback_payload end |
#postback_title ⇒ Object
Title of the tapped postback button (Facebook/Instagram Messenger).
26 27 28 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 26 def postback_title @postback_title end |
#quick_reply_payload ⇒ Object
Payload from a quick reply tap (Facebook/Instagram Messenger).
20 21 22 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 20 def quick_reply_payload @quick_reply_payload end |
#referral ⇒ Object
Returns the value of attribute referral.
61 62 63 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 61 def referral @referral end |
#referred_product ⇒ Object
Returns the value of attribute referred_product.
48 49 50 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 48 def referred_product @referred_product end |
#story_reply ⇒ Object
Returns the value of attribute story_reply.
56 57 58 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 56 def story_reply @story_reply end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
108 109 110 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 108 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
113 114 115 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 113 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 86 def self.attribute_map { :'quick_reply_payload' => :'quickReplyPayload', :'postback_payload' => :'postbackPayload', :'postback_title' => :'postbackTitle', :'callback_data' => :'callbackData', :'interactive_type' => :'interactiveType', :'interactive_id' => :'interactiveId', :'button_payload' => :'buttonPayload', :'flow_response_json' => :'flowResponseJson', :'flow_response_data' => :'flowResponseData', :'order' => :'order', :'referred_product' => :'referredProduct', :'contacts' => :'contacts', :'contacts_origin' => :'contactsOrigin', :'story_reply' => :'storyReply', :'is_story_mention' => :'isStoryMention', :'referral' => :'referral' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 307 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
140 141 142 143 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 140 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 118 def self.openapi_types { :'quick_reply_payload' => :'String', :'postback_payload' => :'String', :'postback_title' => :'String', :'callback_data' => :'String', :'interactive_type' => :'String', :'interactive_id' => :'String', :'button_payload' => :'String', :'flow_response_json' => :'String', :'flow_response_data' => :'Hash<String, Object>', :'order' => :'WebhookPayloadMessageMetadataOrder', :'referred_product' => :'WebhookPayloadMessageMetadataReferredProduct', :'contacts' => :'Array<Hash<String, Object>>', :'contacts_origin' => :'String', :'story_reply' => :'WebhookPayloadMessageMetadataStoryReply', :'is_story_mention' => :'Boolean', :'referral' => :'WebhookPayloadMessageMetadataReferral' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 271 def ==(o) return true if self.equal?(o) self.class == o.class && quick_reply_payload == o.quick_reply_payload && postback_payload == o.postback_payload && postback_title == o.postback_title && callback_data == o.callback_data && interactive_type == o.interactive_type && interactive_id == o.interactive_id && == o. && flow_response_json == o.flow_response_json && flow_response_data == o.flow_response_data && order == o.order && referred_product == o.referred_product && contacts == o.contacts && contacts_origin == o.contacts_origin && story_reply == o.story_reply && is_story_mention == o.is_story_mention && referral == o.referral end |
#eql?(o) ⇒ Boolean
294 295 296 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 294 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
300 301 302 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 300 def hash [quick_reply_payload, postback_payload, postback_title, callback_data, interactive_type, interactive_id, , flow_response_json, flow_response_data, order, referred_product, contacts, contacts_origin, story_reply, is_story_mention, referral].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
232 233 234 235 236 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 232 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 329 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
240 241 242 243 244 245 246 247 |
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 240 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' interactive_type_validator = EnumAttributeValidator.new('String', ["button_reply", "list_reply", "nfm_reply"]) return false unless interactive_type_validator.valid?(@interactive_type) contacts_origin_validator = EnumAttributeValidator.new('String', ["contact_request", "other"]) return false unless contacts_origin_validator.valid?(@contacts_origin) true end |