Class: Zernio::MetaLeadForm

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

Overview

A Meta Lead Gen form as Graph returns it, in Meta's own snake_case. Read through GET /v1/ads/lead-forms/formId. Every setting POST /v1/ads/lead-forms writes is present here, so a form can be diffed against what was created and drift from edits made in Meta's form builder is detectable. A compound field is omitted entirely when the form has no value for it, and fields narrows the selection.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 138

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'tracking_parameters')
    if (value = attributes[:'tracking_parameters']).is_a?(Array)
      self.tracking_parameters = value
    end
  end

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

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

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

  if attributes.key?(:'questions')
    if (value = attributes[:'questions']).is_a?(Array)
      self.questions = value
    end
  end
end

Instance Attribute Details

#allow_organic_leadObject

Whether the form can also be submitted from an organic Page post.



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

def allow_organic_lead
  @allow_organic_lead
end

#block_display_for_non_targeted_viewerObject

Returns the value of attribute block_display_for_non_targeted_viewer.



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

def block_display_for_non_targeted_viewer
  @block_display_for_non_targeted_viewer
end

#context_cardObject

Returns the value of attribute context_card.



60
61
62
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 60

def context_card
  @context_card
end

#created_timeObject

Returns the value of attribute created_time.



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

def created_time
  @created_time
end

#expired_leads_countObject

Leads Meta has aged out of the retention window.



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

def expired_leads_count
  @expired_leads_count
end

#follow_up_action_textObject

Returns the value of attribute follow_up_action_text.



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

def follow_up_action_text
  @follow_up_action_text
end

#follow_up_action_urlObject

Returns the value of attribute follow_up_action_url.



42
43
44
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 42

def follow_up_action_url
  @follow_up_action_url
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#is_optimized_for_qualityObject

Returns the value of attribute is_optimized_for_quality.



48
49
50
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 48

def is_optimized_for_quality
  @is_optimized_for_quality
end

#leads_countObject

Returns the value of attribute leads_count.



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

def leads_count
  @leads_count
end

Returns the value of attribute legal_content.



58
59
60
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 58

def legal_content
  @legal_content
end

#localeObject

Returns the value of attribute locale.



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

def locale
  @locale
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 21

def name
  @name
end

#organic_leads_countObject

Returns the value of attribute organic_leads_count.



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

def organic_leads_count
  @organic_leads_count
end

#page_idObject

Owning Facebook Page. A form on any other Page is a 404, whether read or archived.



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

def page_id
  @page_id
end

#privacy_policy_urlObject

Returns the value of attribute privacy_policy_url.



40
41
42
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 40

def privacy_policy_url
  @privacy_policy_url
end

#question_page_custom_headlineObject

Returns the value of attribute question_page_custom_headline.



46
47
48
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 46

def question_page_custom_headline
  @question_page_custom_headline
end

#questionsObject

Returns the value of attribute questions.



64
65
66
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 64

def questions
  @questions
end

#statusObject

One of ACTIVE, ARCHIVED, DELETED or DRAFT.



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

def status
  @status
end

#thank_you_pageObject

Returns the value of attribute thank_you_page.



62
63
64
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 62

def thank_you_page
  @thank_you_page
end

#tracking_parametersObject

Custom key/value pairs attached to every lead of this form.



56
57
58
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 56

def tracking_parameters
  @tracking_parameters
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



94
95
96
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 94

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



99
100
101
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 99

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 67

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'status' => :'status',
    :'locale' => :'locale',
    :'created_time' => :'created_time',
    :'page_id' => :'page_id',
    :'leads_count' => :'leads_count',
    :'organic_leads_count' => :'organic_leads_count',
    :'expired_leads_count' => :'expired_leads_count',
    :'privacy_policy_url' => :'privacy_policy_url',
    :'follow_up_action_url' => :'follow_up_action_url',
    :'follow_up_action_text' => :'follow_up_action_text',
    :'question_page_custom_headline' => :'question_page_custom_headline',
    :'is_optimized_for_quality' => :'is_optimized_for_quality',
    :'block_display_for_non_targeted_viewer' => :'block_display_for_non_targeted_viewer',
    :'allow_organic_lead' => :'allow_organic_lead',
    :'tracking_parameters' => :'tracking_parameters',
    :'legal_content' => :'legal_content',
    :'context_card' => :'context_card',
    :'thank_you_page' => :'thank_you_page',
    :'questions' => :'questions'
  }
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



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 299

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



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

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'status' => :'String',
    :'locale' => :'String',
    :'created_time' => :'Time',
    :'page_id' => :'String',
    :'leads_count' => :'Integer',
    :'organic_leads_count' => :'Integer',
    :'expired_leads_count' => :'Integer',
    :'privacy_policy_url' => :'String',
    :'follow_up_action_url' => :'String',
    :'follow_up_action_text' => :'String',
    :'question_page_custom_headline' => :'String',
    :'is_optimized_for_quality' => :'Boolean',
    :'block_display_for_non_targeted_viewer' => :'Boolean',
    :'allow_organic_lead' => :'Boolean',
    :'tracking_parameters' => :'Array<BoostPostRequestTrackingUrlTagsInner>',
    :'legal_content' => :'MetaLeadFormLegalContent',
    :'context_card' => :'MetaLeadFormContextCard',
    :'thank_you_page' => :'MetaLeadFormThankYouPage',
    :'questions' => :'Array<MetaLeadFormQuestionsInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 258

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      status == o.status &&
      locale == o.locale &&
      created_time == o.created_time &&
      page_id == o.page_id &&
      leads_count == o.leads_count &&
      organic_leads_count == o.organic_leads_count &&
      expired_leads_count == o.expired_leads_count &&
      privacy_policy_url == o.privacy_policy_url &&
      follow_up_action_url == o.follow_up_action_url &&
      follow_up_action_text == o.follow_up_action_text &&
      question_page_custom_headline == o.question_page_custom_headline &&
      is_optimized_for_quality == o.is_optimized_for_quality &&
      block_display_for_non_targeted_viewer == o.block_display_for_non_targeted_viewer &&
      allow_organic_lead == o.allow_organic_lead &&
      tracking_parameters == o.tracking_parameters &&
      legal_content == o.legal_content &&
      context_card == o.context_card &&
      thank_you_page == o.thank_you_page &&
      questions == o.questions
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


286
287
288
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 286

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



292
293
294
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 292

def hash
  [id, name, status, locale, created_time, page_id, leads_count, organic_leads_count, expired_leads_count, privacy_policy_url, follow_up_action_url, follow_up_action_text, question_page_custom_headline, is_optimized_for_quality, block_display_for_non_targeted_viewer, allow_organic_lead, tracking_parameters, legal_content, context_card, thank_you_page, questions].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



243
244
245
246
247
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 243

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



321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 321

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



251
252
253
254
# File 'lib/zernio-sdk/models/meta_lead_form.rb', line 251

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