Class: Zernio::WebhookPayloadMessageMetadataReferral

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb

Overview

Ad-click attribution forwarded verbatim from Meta. Populated only on the FIRST inbound message after the click; absent on subsequent messages of the same conversation. The populated subset identifies the source platform: - ctwa_clid and source_* fields: WhatsApp CTWA (Click-to-WhatsApp). Attribution window is 7 days from click. Forward to Meta Conversions API for Business Messaging replay. - ad_id and ads_context_data: Facebook Messenger CTM (Click-to-Message) or Instagram CTD (Click-to-Direct). Use ad_id to attribute the conversation to a specific ad.

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 = {}) ⇒ WebhookPayloadMessageMetadataReferral

Initializes the object

Parameters:

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

    Model attributes in the form of hash



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 114

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadMessageMetadataReferral` 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::WebhookPayloadMessageMetadataReferral`. 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?(:'ctwa_clid')
    self.ctwa_clid = attributes[:'ctwa_clid']
  end

  if attributes.key?(:'source_id')
    self.source_id = attributes[:'source_id']
  end

  if attributes.key?(:'source_type')
    self.source_type = attributes[:'source_type']
  end

  if attributes.key?(:'source_url')
    self.source_url = attributes[:'source_url']
  end

  if attributes.key?(:'headline')
    self.headline = attributes[:'headline']
  end

  if attributes.key?(:'body')
    self.body = attributes[:'body']
  end

  if attributes.key?(:'media_type')
    self.media_type = attributes[:'media_type']
  end

  if attributes.key?(:'image_url')
    self.image_url = attributes[:'image_url']
  end

  if attributes.key?(:'video_url')
    self.video_url = attributes[:'video_url']
  end

  if attributes.key?(:'thumbnail_url')
    self.thumbnail_url = attributes[:'thumbnail_url']
  end

  if attributes.key?(:'ad_id')
    self.ad_id = attributes[:'ad_id']
  end

  if attributes.key?(:'ref')
    self.ref = attributes[:'ref']
  end

  if attributes.key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'ads_context_data')
    self.ads_context_data = attributes[:'ads_context_data']
  end
end

Instance Attribute Details

#ad_idObject

Facebook Messenger CTM / Instagram CTD only. The Meta ad ID the user clicked to start the conversation.



41
42
43
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 41

def ad_id
  @ad_id
end

#ads_context_dataObject

Returns the value of attribute ads_context_data.



52
53
54
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 52

def ads_context_data
  @ads_context_data
end

#bodyObject

Returns the value of attribute body.



30
31
32
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 30

def body
  @body
end

#ctwa_clidObject

Meta's GCLID-equivalent click identifier.



20
21
22
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 20

def ctwa_clid
  @ctwa_clid
end

#headlineObject

Returns the value of attribute headline.



28
29
30
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 28

def headline
  @headline
end

#image_urlObject

Returns the value of attribute image_url.



34
35
36
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 34

def image_url
  @image_url
end

#media_typeObject

Returns the value of attribute media_type.



32
33
34
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 32

def media_type
  @media_type
end

#refObject

Optional ref parameter passed through from the Meta ad creative. Facebook Messenger CTM / Instagram CTD only.



44
45
46
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 44

def ref
  @ref
end

#sourceObject

Meta-supplied source identifier (e.g. ADS). Facebook Messenger CTM / Instagram CTD only.



47
48
49
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 47

def source
  @source
end

#source_idObject

Returns the value of attribute source_id.



22
23
24
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 22

def source_id
  @source_id
end

#source_typeObject

Returns the value of attribute source_type.



24
25
26
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 24

def source_type
  @source_type
end

#source_urlObject

Returns the value of attribute source_url.



26
27
28
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 26

def source_url
  @source_url
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



38
39
40
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 38

def thumbnail_url
  @thumbnail_url
end

#typeObject

Meta-supplied referral type (e.g. OPEN_THREAD). Facebook Messenger CTM / Instagram CTD only.



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

def type
  @type
end

#video_urlObject

Returns the value of attribute video_url.



36
37
38
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 36

def video_url
  @video_url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



76
77
78
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 76

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



81
82
83
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 81

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 55

def self.attribute_map
  {
    :'ctwa_clid' => :'ctwa_clid',
    :'source_id' => :'source_id',
    :'source_type' => :'source_type',
    :'source_url' => :'source_url',
    :'headline' => :'headline',
    :'body' => :'body',
    :'media_type' => :'media_type',
    :'image_url' => :'image_url',
    :'video_url' => :'video_url',
    :'thumbnail_url' => :'thumbnail_url',
    :'ad_id' => :'ad_id',
    :'ref' => :'ref',
    :'source' => :'source',
    :'type' => :'type',
    :'ads_context_data' => :'ads_context_data'
  }
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



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

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



107
108
109
110
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 107

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

.openapi_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 86

def self.openapi_types
  {
    :'ctwa_clid' => :'String',
    :'source_id' => :'String',
    :'source_type' => :'String',
    :'source_url' => :'String',
    :'headline' => :'String',
    :'body' => :'String',
    :'media_type' => :'String',
    :'image_url' => :'String',
    :'video_url' => :'String',
    :'thumbnail_url' => :'String',
    :'ad_id' => :'String',
    :'ref' => :'String',
    :'source' => :'String',
    :'type' => :'String',
    :'ads_context_data' => :'WebhookPayloadMessageMetadataReferralAdsContextData'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 206

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ctwa_clid == o.ctwa_clid &&
      source_id == o.source_id &&
      source_type == o.source_type &&
      source_url == o.source_url &&
      headline == o.headline &&
      body == o.body &&
      media_type == o.media_type &&
      image_url == o.image_url &&
      video_url == o.video_url &&
      thumbnail_url == o.thumbnail_url &&
      ad_id == o.ad_id &&
      ref == o.ref &&
      source == o.source &&
      type == o.type &&
      ads_context_data == o.ads_context_data
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


228
229
230
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 228

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



234
235
236
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 234

def hash
  [ctwa_clid, source_id, source_type, source_url, headline, body, media_type, image_url, video_url, thumbnail_url, ad_id, ref, source, type, ads_context_data].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



191
192
193
194
195
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 191

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



263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 263

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



199
200
201
202
# File 'lib/zernio-sdk/models/webhook_payload_message_metadata_referral.rb', line 199

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end