Class: Zernio::CreateAdAccountRequest

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/create_ad_account_request.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 = {}) ⇒ CreateAdAccountRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

  if attributes.key?(:'end_advertiser')
    self.end_advertiser = attributes[:'end_advertiser']
  else
    self.end_advertiser = 'NONE'
  end

  if attributes.key?(:'media_agency')
    self.media_agency = attributes[:'media_agency']
  else
    self.media_agency = 'NONE'
  end

  if attributes.key?(:'partner')
    self.partner = attributes[:'partner']
  else
    self.partner = 'NONE'
  end

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Zernio metaads SocialAccount ID.



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

def 
  @account_id
end

#ad_account_created_from_bm_flagObject

Meta Business Manager creation flag.



61
62
63
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 61

def 
  @ad_account_created_from_bm_flag
end

#business_idObject

Business portfolio that will own the account.



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

def business_id
  @business_id
end

#currencyObject

Uppercase ISO 4217 currency supported by Meta.



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

def currency
  @currency
end

#end_advertiserObject

End advertiser business or page ID. NONE uses the owning business.



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

def end_advertiser
  @end_advertiser
end

#funding_idObject

Existing Meta funding reference. Does not add a payment method.



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

def funding_id
  @funding_id
end

#invoiceObject

Request Meta invoicing. Eligibility is determined by Meta.



43
44
45
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 43

def invoice
  @invoice
end

#invoice_group_idObject

Existing Meta invoice group ID.



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

def invoice_group_id
  @invoice_group_id
end

#invoicing_emailsObject

Addresses for Meta invoices.



49
50
51
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 49

def invoicing_emails
  @invoicing_emails
end

#ioObject

Meta insertion-order invoicing option.



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

def io
  @io
end

#media_agencyObject

Media agency business or page ID. NONE for self-serve customers.



37
38
39
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 37

def media_agency
  @media_agency
end

#nameObject

Ad account name. Whitespace is trimmed.



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

def name
  @name
end

#partnerObject

Partner business or page ID. NONE for self-serve customers.



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

def partner
  @partner
end

#po_numberObject

Purchase order number.



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

def po_number
  @po_number
end

#timezone_idObject

Numeric Meta timezone ID from the linked timezone list. For example 1 is America/Los_Angeles.



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

def timezone_id
  @timezone_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



85
86
87
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 85

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



90
91
92
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 90

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 64

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'business_id' => :'businessId',
    :'name' => :'name',
    :'currency' => :'currency',
    :'timezone_id' => :'timezoneId',
    :'end_advertiser' => :'endAdvertiser',
    :'media_agency' => :'mediaAgency',
    :'partner' => :'partner',
    :'invoice' => :'invoice',
    :'invoice_group_id' => :'invoiceGroupId',
    :'invoicing_emails' => :'invoicingEmails',
    :'io' => :'io',
    :'po_number' => :'poNumber',
    :'funding_id' => :'fundingId',
    :'ad_account_created_from_bm_flag' => :'adAccountCreatedFromBmFlag'
  }
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



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 573

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



116
117
118
119
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 116

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

.openapi_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 95

def self.openapi_types
  {
    :'account_id' => :'String',
    :'business_id' => :'String',
    :'name' => :'String',
    :'currency' => :'String',
    :'timezone_id' => :'Integer',
    :'end_advertiser' => :'String',
    :'media_agency' => :'String',
    :'partner' => :'String',
    :'invoice' => :'Boolean',
    :'invoice_group_id' => :'String',
    :'invoicing_emails' => :'Array<String>',
    :'io' => :'Boolean',
    :'po_number' => :'String',
    :'funding_id' => :'String',
    :'ad_account_created_from_bm_flag' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 538

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      business_id == o.business_id &&
      name == o.name &&
      currency == o.currency &&
      timezone_id == o.timezone_id &&
      end_advertiser == o.end_advertiser &&
      media_agency == o.media_agency &&
      partner == o.partner &&
      invoice == o.invoice &&
      invoice_group_id == o.invoice_group_id &&
      invoicing_emails == o.invoicing_emails &&
      io == o.io &&
      po_number == o.po_number &&
      funding_id == o.funding_id &&
       == o.
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


560
561
562
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 560

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



566
567
568
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 566

def hash
  [, business_id, name, currency, timezone_id, end_advertiser, media_agency, partner, invoice, invoice_group_id, invoicing_emails, io, po_number, funding_id, ].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 218

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

  pattern = Regexp.new(/^[a-fA-F0-9]{24}$/)
  if @account_id !~ pattern
    invalid_properties.push("invalid value for \"account_id\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^[1-9][0-9]*$/)
  if @business_id !~ pattern
    invalid_properties.push("invalid value for \"business_id\", must conform to the pattern #{pattern}.")
  end

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

  if @name.to_s.length > 255
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
  end

  if @name.to_s.length < 1
    invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
  end

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

  pattern = Regexp.new(/^[A-Z]{3}$/)
  if @currency !~ pattern
    invalid_properties.push("invalid value for \"currency\", must conform to the pattern #{pattern}.")
  end

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

  if @timezone_id > 4294967295
    invalid_properties.push('invalid value for "timezone_id", must be smaller than or equal to 4294967295.')
  end

  if @timezone_id < 0
    invalid_properties.push('invalid value for "timezone_id", must be greater than or equal to 0.')
  end

  pattern = Regexp.new(/^(NONE|[1-9][0-9]*)$/)
  if !@end_advertiser.nil? && @end_advertiser !~ pattern
    invalid_properties.push("invalid value for \"end_advertiser\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^(NONE|[1-9][0-9]*)$/)
  if !@media_agency.nil? && @media_agency !~ pattern
    invalid_properties.push("invalid value for \"media_agency\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^(NONE|[1-9][0-9]*)$/)
  if !@partner.nil? && @partner !~ pattern
    invalid_properties.push("invalid value for \"partner\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[1-9][0-9]*$/)
  if !@invoice_group_id.nil? && @invoice_group_id !~ pattern
    invalid_properties.push("invalid value for \"invoice_group_id\", must conform to the pattern #{pattern}.")
  end

  if !@invoicing_emails.nil? && @invoicing_emails.length > 100
    invalid_properties.push('invalid value for "invoicing_emails", number of items must be less than or equal to 100.')
  end

  if !@invoicing_emails.nil? && @invoicing_emails.length < 1
    invalid_properties.push('invalid value for "invoicing_emails", number of items must be greater than or equal to 1.')
  end

  if !@po_number.nil? && @po_number.to_s.length > 255
    invalid_properties.push('invalid value for "po_number", the character length must be smaller than or equal to 255.')
  end

  if !@po_number.nil? && @po_number.to_s.length < 1
    invalid_properties.push('invalid value for "po_number", the character length must be greater than or equal to 1.')
  end

  pattern = Regexp.new(/^[1-9][0-9]*$/)
  if !@funding_id.nil? && @funding_id !~ pattern
    invalid_properties.push("invalid value for \"funding_id\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 595

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



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/zernio-sdk/models/create_ad_account_request.rb', line 318

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @account_id !~ Regexp.new(/^[a-fA-F0-9]{24}$/)
  return false if @business_id.nil?
  return false if @business_id !~ Regexp.new(/^[1-9][0-9]*$/)
  return false if @name.nil?
  return false if @name.to_s.length > 255
  return false if @name.to_s.length < 1
  return false if @currency.nil?
  return false if @currency !~ Regexp.new(/^[A-Z]{3}$/)
  return false if @timezone_id.nil?
  return false if @timezone_id > 4294967295
  return false if @timezone_id < 0
  return false if !@end_advertiser.nil? && @end_advertiser !~ Regexp.new(/^(NONE|[1-9][0-9]*)$/)
  return false if !@media_agency.nil? && @media_agency !~ Regexp.new(/^(NONE|[1-9][0-9]*)$/)
  return false if !@partner.nil? && @partner !~ Regexp.new(/^(NONE|[1-9][0-9]*)$/)
  return false if !@invoice_group_id.nil? && @invoice_group_id !~ Regexp.new(/^[1-9][0-9]*$/)
  return false if !@invoicing_emails.nil? && @invoicing_emails.length > 100
  return false if !@invoicing_emails.nil? && @invoicing_emails.length < 1
  return false if !@po_number.nil? && @po_number.to_s.length > 255
  return false if !@po_number.nil? && @po_number.to_s.length < 1
  return false if !@funding_id.nil? && @funding_id !~ Regexp.new(/^[1-9][0-9]*$/)
  true
end