Class: PinterestSdkClient::SSIOCreateInsertionOrderRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
315
316
317
318
319
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 186

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#accepted_terms_idObject

The SFDC id for the terms



55
56
57
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 55

def accepted_terms_id
  @accepted_terms_id
end

#accepted_terms_timeObject

The UTC timestamp (to the nearest sec) of when terms were accepted



58
59
60
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 58

def accepted_terms_time
  @accepted_terms_time
end

URL link for agency



19
20
21
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 19

def agency_link
  @agency_link
end

#billing_contact_emailObject

The billing contact email



22
23
24
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 22

def billing_contact_email
  @billing_contact_email
end

#billing_contact_firstnameObject

The billing contact first name



25
26
27
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 25

def billing_contact_firstname
  @billing_contact_firstname
end

#billing_contact_lastnameObject

The billing contact last name



28
29
30
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 28

def billing_contact_lastname
  @billing_contact_lastname
end

#billto_billing_address_idObject

The bill-to billing address id



61
62
63
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 61

def billto_billing_address_id
  @billto_billing_address_id
end

#billto_business_address_idObject

The bill-to business address id



64
65
66
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 64

def billto_business_address_id
  @billto_business_address_id
end

#billto_company_idObject

The bill-to company id



67
68
69
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 67

def billto_company_id
  @billto_company_id
end

#budget_amountObject

If Budget order line, the budget amount.



31
32
33
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 31

def budget_amount
  @budget_amount
end

#currency_infoObject

Returns the value of attribute currency_info.



69
70
71
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 69

def currency_info
  @currency_info
end

#end_dateObject

End date of time period. Format: YYYY-MM-DD



34
35
36
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 34

def end_date
  @end_date
end

#estimated_monthly_spendObject

If Ongoing (perpetual) order line, the estimated monthly spend



72
73
74
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 72

def estimated_monthly_spend
  @estimated_monthly_spend
end

#media_contact_emailObject

The media contact email



37
38
39
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 37

def media_contact_email
  @media_contact_email
end

#media_contact_firstnameObject

The media contact first name



40
41
42
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 40

def media_contact_firstname
  @media_contact_firstname
end

#media_contact_lastnameObject

The media contact last name



43
44
45
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 43

def media_contact_lastname
  @media_contact_lastname
end

#order_line_typeObject

Type can be Budget or Perpetual



75
76
77
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 75

def order_line_type
  @order_line_type
end

#order_nameObject

The order name



78
79
80
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 78

def order_name
  @order_name
end

#pmp_idObject

The pmp id



81
82
83
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 81

def pmp_id
  @pmp_id
end

#po_numberObject

The po number



46
47
48
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 46

def po_number
  @po_number
end

#start_dateObject

Starting date of time period. Format: YYYY-MM-DD



49
50
51
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 49

def start_date
  @start_date
end

#user_emailObject

The email of user submitting the insertion order



52
53
54
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 52

def user_email
  @user_email
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



134
135
136
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 134

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



139
140
141
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 139

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 106

def self.attribute_map
  {
    :'agency_link' => :'agency_link',
    :'billing_contact_email' => :'billing_contact_email',
    :'billing_contact_firstname' => :'billing_contact_firstname',
    :'billing_contact_lastname' => :'billing_contact_lastname',
    :'budget_amount' => :'budget_amount',
    :'end_date' => :'end_date',
    :'media_contact_email' => :'media_contact_email',
    :'media_contact_firstname' => :'media_contact_firstname',
    :'media_contact_lastname' => :'media_contact_lastname',
    :'po_number' => :'po_number',
    :'start_date' => :'start_date',
    :'user_email' => :'user_email',
    :'accepted_terms_id' => :'accepted_terms_id',
    :'accepted_terms_time' => :'accepted_terms_time',
    :'billto_billing_address_id' => :'billto_billing_address_id',
    :'billto_business_address_id' => :'billto_business_address_id',
    :'billto_company_id' => :'billto_company_id',
    :'currency_info' => :'currency_info',
    :'estimated_monthly_spend' => :'estimated_monthly_spend',
    :'order_line_type' => :'order_line_type',
    :'order_name' => :'order_name',
    :'pmp_id' => :'pmp_id'
  }
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



654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 654

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_all_ofObject

List of class defined in allOf (OpenAPI v3)



178
179
180
181
182
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 178

def self.openapi_all_of
  [
  :'SSIOInsertionOrderCommon'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



172
173
174
175
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 172

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 144

def self.openapi_types
  {
    :'agency_link' => :'String',
    :'billing_contact_email' => :'String',
    :'billing_contact_firstname' => :'String',
    :'billing_contact_lastname' => :'String',
    :'budget_amount' => :'Float',
    :'end_date' => :'String',
    :'media_contact_email' => :'String',
    :'media_contact_firstname' => :'String',
    :'media_contact_lastname' => :'String',
    :'po_number' => :'String',
    :'start_date' => :'String',
    :'user_email' => :'String',
    :'accepted_terms_id' => :'String',
    :'accepted_terms_time' => :'Integer',
    :'billto_billing_address_id' => :'String',
    :'billto_business_address_id' => :'String',
    :'billto_company_id' => :'String',
    :'currency_info' => :'Currency',
    :'estimated_monthly_spend' => :'Float',
    :'order_line_type' => :'String',
    :'order_name' => :'String',
    :'pmp_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 612

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      agency_link == o.agency_link &&
      billing_contact_email == o.billing_contact_email &&
      billing_contact_firstname == o.billing_contact_firstname &&
      billing_contact_lastname == o.billing_contact_lastname &&
      budget_amount == o.budget_amount &&
      end_date == o.end_date &&
      media_contact_email == o.media_contact_email &&
      media_contact_firstname == o.media_contact_firstname &&
      media_contact_lastname == o.media_contact_lastname &&
      po_number == o.po_number &&
      start_date == o.start_date &&
      user_email == o.user_email &&
      accepted_terms_id == o.accepted_terms_id &&
      accepted_terms_time == o.accepted_terms_time &&
      billto_billing_address_id == o.billto_billing_address_id &&
      billto_business_address_id == o.billto_business_address_id &&
      billto_company_id == o.billto_company_id &&
      currency_info == o.currency_info &&
      estimated_monthly_spend == o.estimated_monthly_spend &&
      order_line_type == o.order_line_type &&
      order_name == o.order_name &&
      pmp_id == o.pmp_id
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


641
642
643
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 641

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



647
648
649
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 647

def hash
  [agency_link, billing_contact_email, billing_contact_firstname, billing_contact_lastname, budget_amount, end_date, media_contact_email, media_contact_firstname, media_contact_lastname, po_number, start_date, user_email, accepted_terms_id, accepted_terms_time, billto_billing_address_id, billto_business_address_id, billto_company_id, currency_info, estimated_monthly_spend, order_line_type, order_name, pmp_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



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 323

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

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

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

  pattern = Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  if !@end_date.nil? && @end_date !~ pattern
    invalid_properties.push("invalid value for \"end_date\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

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

  pattern = Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  if @start_date !~ pattern
    invalid_properties.push("invalid value for \"start_date\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

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

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

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

  if @pmp_id.nil?
    invalid_properties.push('invalid value for "pmp_id", pmp_id 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



676
677
678
679
680
681
682
683
684
685
686
687
688
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 676

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



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/pinterest_sdk/models/ssio_create_insertion_order_request.rb', line 405

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @billing_contact_email.nil?
  return false if @billing_contact_firstname.nil?
  return false if @billing_contact_lastname.nil?
  return false if !@end_date.nil? && @end_date !~ Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  return false if @media_contact_email.nil?
  return false if @media_contact_firstname.nil?
  return false if @media_contact_lastname.nil?
  return false if @po_number.nil?
  return false if @start_date.nil?
  return false if @start_date !~ Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  return false if @accepted_terms_id.nil?
  return false if @billto_billing_address_id.nil?
  return false if @billto_business_address_id.nil?
  return false if @billto_company_id.nil?
  return false if @currency_info.nil?
  return false if @order_line_type.nil?
  order_line_type_validator = EnumAttributeValidator.new('String', ["BUDGET", "PERPETUALS"])
  return false unless order_line_type_validator.valid?(@order_line_type)
  return false if @order_name.nil?
  return false if @pmp_id.nil?
  true
end