Class: Zernio::WebhookPayloadLeadLead

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/webhook_payload_lead_lead.rb

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



100
101
102
103
104
105
106
107
108
109
110
111
112
113
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
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 100

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

  if attributes.key?(:'leadgen_id')
    self.leadgen_id = attributes[:'leadgen_id']
  else
    self.leadgen_id = nil
  end

  if attributes.key?(:'form_id')
    self.form_id = attributes[:'form_id']
  else
    self.form_id = nil
  end

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

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

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

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

  if attributes.key?(:'fields')
    if (value = attributes[:'fields']).is_a?(Hash)
      self.fields = value
    end
  else
    self.fields = nil
  end

  if attributes.key?(:'is_organic')
    self.is_organic = attributes[:'is_organic']
  else
    self.is_organic = nil
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end
end

Instance Attribute Details

#ad_idObject

Meta ad ID that drove the lead (null for organic/test leads)



31
32
33
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 31

def ad_id
  @ad_id
end

#adset_idObject

Returns the value of attribute adset_id.



33
34
35
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 33

def adset_id
  @adset_id
end

#campaign_idObject

Returns the value of attribute campaign_id.



35
36
37
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 35

def campaign_id
  @campaign_id
end

#created_atObject

Meta's lead creation time (ISO 8601)



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

def created_at
  @created_at
end

#fieldsObject

Flattened question key -> answer map. For multiple-choice questions the value is the option key (e.g. "k1"), not the display label.



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

def fields
  @fields
end

#form_idObject

Lead Gen form ID the lead was submitted against



25
26
27
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 25

def form_id
  @form_id
end

#form_nameObject

Human-readable form name (best-effort; may be null)



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

def form_name
  @form_name
end

#idObject

Zernio lead ID (AdLead document ID)



19
20
21
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 19

def id
  @id
end

#is_organicObject

True when the lead came from an organic post rather than a paid ad



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

def is_organic
  @is_organic
end

#leadgen_idObject

Meta lead ID (the platform's leadgen_id)



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

def leadgen_id
  @leadgen_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



63
64
65
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 63

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



68
69
70
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 68

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 47

def self.attribute_map
  {
    :'id' => :'id',
    :'leadgen_id' => :'leadgenId',
    :'form_id' => :'formId',
    :'form_name' => :'formName',
    :'ad_id' => :'adId',
    :'adset_id' => :'adsetId',
    :'campaign_id' => :'campaignId',
    :'fields' => :'fields',
    :'is_organic' => :'isOrganic',
    :'created_at' => :'createdAt'
  }
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



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 306

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



89
90
91
92
93
94
95
96
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 89

def self.openapi_nullable
  Set.new([
    :'form_name',
    :'ad_id',
    :'adset_id',
    :'campaign_id',
  ])
end

.openapi_typesObject

Attribute type mapping.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 73

def self.openapi_types
  {
    :'id' => :'String',
    :'leadgen_id' => :'String',
    :'form_id' => :'String',
    :'form_name' => :'String',
    :'ad_id' => :'String',
    :'adset_id' => :'String',
    :'campaign_id' => :'String',
    :'fields' => :'Hash<String, String>',
    :'is_organic' => :'Boolean',
    :'created_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 276

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      leadgen_id == o.leadgen_id &&
      form_id == o.form_id &&
      form_name == o.form_name &&
      ad_id == o.ad_id &&
      adset_id == o.adset_id &&
      campaign_id == o.campaign_id &&
      fields == o.fields &&
      is_organic == o.is_organic &&
      created_at == o.created_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


293
294
295
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 293

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



299
300
301
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 299

def hash
  [id, leadgen_id, form_id, form_name, ad_id, adset_id, campaign_id, fields, is_organic, created_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 171

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @leadgen_id.nil?
    invalid_properties.push('invalid value for "leadgen_id", leadgen_id cannot be nil.')
  end

  if @form_id.nil?
    invalid_properties.push('invalid value for "form_id", form_id cannot be nil.')
  end

  if @fields.nil?
    invalid_properties.push('invalid value for "fields", fields cannot be nil.')
  end

  if @is_organic.nil?
    invalid_properties.push('invalid value for "is_organic", is_organic cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 328

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



203
204
205
206
207
208
209
210
211
212
# File 'lib/zernio-sdk/models/webhook_payload_lead_lead.rb', line 203

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @leadgen_id.nil?
  return false if @form_id.nil?
  return false if @fields.nil?
  return false if @is_organic.nil?
  return false if @created_at.nil?
  true
end