Class: Zernio::WebhookPayloadMessageMetadata

Inherits:
ApiModelBase show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ WebhookPayloadMessageMetadata

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



137
138
139
140
141
142
143
144
145
146
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
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 137

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.button_payload = 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?(:'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_payloadObject

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
  @button_payload
end

#callback_dataObject

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

#flow_response_dataObject

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_jsonObject

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_idObject

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_typeObject

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_mentionObject

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.



53
54
55
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 53

def is_story_mention
  @is_story_mention
end

#orderObject

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_payloadObject

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_titleObject

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_payloadObject

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

#referralObject

Returns the value of attribute referral.



55
56
57
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 55

def referral
  @referral
end

#referred_productObject

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_replyObject

Returns the value of attribute story_reply.



50
51
52
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 50

def story_reply
  @story_reply
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



100
101
102
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 100

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



105
106
107
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 105

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 80

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',
    :'story_reply' => :'storyReply',
    :'is_story_mention' => :'isStoryMention',
    :'referral' => :'referral'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 273

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_nullableObject

List of attributes with nullable: true



130
131
132
133
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 130

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 110

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',
    :'story_reply' => :'WebhookPayloadMessageMetadataStoryReply',
    :'is_story_mention' => :'Boolean',
    :'referral' => :'WebhookPayloadMessageMetadataReferral'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 239

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 &&
      button_payload == o.button_payload &&
      flow_response_json == o.flow_response_json &&
      flow_response_data == o.flow_response_data &&
      order == o.order &&
      referred_product == o.referred_product &&
      story_reply == o.story_reply &&
      is_story_mention == o.is_story_mention &&
      referral == o.referral
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


260
261
262
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 260

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



266
267
268
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 266

def hash
  [quick_reply_payload, postback_payload, postback_title, callback_data, interactive_type, interactive_id, button_payload, flow_response_json, flow_response_data, order, referred_product, story_reply, is_story_mention, referral].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



212
213
214
215
216
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 212

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 295

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

Returns:

  • (Boolean)

    true if the model is valid



220
221
222
223
224
225
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata.rb', line 220

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)
  true
end