Class: PinterestSdkClient::CampaignCreateResponseData

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/campaign_create_response_data.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 = {}) ⇒ CampaignCreateResponseData

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_account_idObject

Campaign’s Advertiser ID. If you want to create a campaign in a Business Account shared account you need to specify the Business Access advertiser ID in both the query path param as well as the request body schema.



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

def 
  @ad_account_id
end

#bid_optionsObject

Returns the value of attribute bid_options.



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

def bid_options
  @bid_options
end

#created_timeObject

Campaign creation time. Unix timestamp in seconds.



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

def created_time
  @created_time
end

#daily_spend_capObject

Campaign daily spending cap. Required for Campaign Budget Optimization (CBO) campaigns. This and "lifetime_spend_cap" cannot be set at the same time.



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

def daily_spend_cap
  @daily_spend_cap
end

#default_ad_group_budget_in_micro_currencyObject

When transitioning from campaign budget optimization to non-campaign budget optimization, the default_ad_group_budget_in_micro_currency will propagate to each child ad groups daily budget. Unit is micro currency of the associated advertiser account.



50
51
52
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 50

def default_ad_group_budget_in_micro_currency
  @default_ad_group_budget_in_micro_currency
end

#end_timeObject

Timestamp in Unix format for scheduling when ads in the campaign stop appearing. Must occur after any end times for child ad groups. If end_time is not specified for the campaign, ads run indefinitely unless you update the campaign, changing their status to paused. Learn about <a href="/docs/api-features/managing-campaigns/#campaign-scheduling" target="blank">scheduling campaigns</a>. Different end times can be set for the campaign’s child ad groups, but they cannot occur after an end_time specified for the campaign. - If your campaign has a child ad group with an end time specified, and if you update that campaign with an end_time that is earlier than that of the ad group, the campaign end_time will supersede the ad group end_time, and the request will not return an error. - In this scenario, if you call <a href="/docs/api/v5/campaigns-list" target="blank">List campaigns</a> or <a href="/docs/api/v5/ad_groups-list" target="blank">List ad groups</a>, the returned campaigns or ad groups are listed with the start and end times that you assigned them, regardless of supersedence.



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

def end_time
  @end_time
end

#idObject

Campaign ID.



56
57
58
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 56

def id
  @id
end

#is_automated_campaignObject

Specifies whether the campaign was created in the automated campaign flow



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

def is_automated_campaign
  @is_automated_campaign
end

#is_campaign_budget_optimizationObject

Determines if a campaign automatically generate ad-group level budgets given a campaign budget to maximize campaign outcome. When transitioning from non-cbo to cbo, all previous child ad group budget will be cleared.



53
54
55
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 53

def is_campaign_budget_optimization
  @is_campaign_budget_optimization
end

#is_flexible_daily_budgetsObject

Determine if a campaign has setup for flexible daily budgets, also known as "Pinterest Performance+ budgets".



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

def is_flexible_daily_budgets
  @is_flexible_daily_budgets
end

#is_performance_plusObject

Enable Pinterest Performance+ for your campaign. To learn more, see <a href="developers.pinterest.com/docs/api-features/pinterest-performance-plus-setup/">Pinterest Performance+ Setup</a>.



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

def is_performance_plus
  @is_performance_plus
end

#lifetime_spend_capObject

Campaign total spending cap. Required for Campaign Budget Optimization (CBO) campaigns. This and "daily_spend_cap" cannot be set at the same time.



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

def lifetime_spend_cap
  @lifetime_spend_cap
end

#nameObject

Campaign name.



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

def name
  @name
end

#objective_typeObject

Returns the value of attribute objective_type.



66
67
68
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 66

def objective_type
  @objective_type
end

#order_line_idObject

Order line ID that appears on the invoice.



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

def order_line_id
  @order_line_id
end

#start_timeObject

Timestamp in Unix format for scheduling when ads in the campaign start to appear. Must precede any start times set for child ad groups. Defaults to current time if no time is specified. Learn about <a href="/docs/api-features/managing-campaigns/#campaign-scheduling" target="blank">scheduling campaigns</a>. Different start times can be set for the campaign’s child ad groups, but they cannot occur before a start_time specified for the campaign. - If your campaign has a child ad group with a start time specified, and if you update that campaign with a start_time that is later than that of the ad group, the campaign start_time will supersede the ad group start_time, and the request will not return an error. - In this scenario, if you call <a href="/docs/api/v5/campaigns-list" target="blank">List campaigns</a> or <a href="/docs/api/v5/ad_groups-list" target="blank">List ad groups</a>, the returned campaigns or ad groups are listed with the start and end times that you assigned them, regardless of supersedence.



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

def start_time
  @start_time
end

#statusObject

Returns the value of attribute status.



45
46
47
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 45

def status
  @status
end

#summary_statusObject

Returns the value of attribute summary_status.



68
69
70
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 68

def summary_status
  @summary_status
end

#tracking_urlsObject

Returns the value of attribute tracking_urls.



47
48
49
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 47

def tracking_urls
  @tracking_urls
end

#typeObject

Always "campaign".



71
72
73
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 71

def type
  @type
end

#updated_timeObject

UTC timestamp. Last update time.



74
75
76
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 74

def updated_time
  @updated_time
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



126
127
128
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 126

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



131
132
133
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 131

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 99

def self.attribute_map
  {
    :'ad_account_id' => :'ad_account_id',
    :'daily_spend_cap' => :'daily_spend_cap',
    :'end_time' => :'end_time',
    :'is_automated_campaign' => :'is_automated_campaign',
    :'is_flexible_daily_budgets' => :'is_flexible_daily_budgets',
    :'lifetime_spend_cap' => :'lifetime_spend_cap',
    :'name' => :'name',
    :'order_line_id' => :'order_line_id',
    :'start_time' => :'start_time',
    :'status' => :'status',
    :'tracking_urls' => :'tracking_urls',
    :'default_ad_group_budget_in_micro_currency' => :'default_ad_group_budget_in_micro_currency',
    :'is_campaign_budget_optimization' => :'is_campaign_budget_optimization',
    :'id' => :'id',
    :'bid_options' => :'bid_options',
    :'created_time' => :'created_time',
    :'is_performance_plus' => :'is_performance_plus',
    :'objective_type' => :'objective_type',
    :'summary_status' => :'summary_status',
    :'type' => :'type',
    :'updated_time' => :'updated_time'
  }
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



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

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)



180
181
182
183
184
185
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 180

def self.openapi_all_of
  [
  :'CampaignCreateCommon',
  :'CampaignResponse'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 163

def self.openapi_nullable
  Set.new([
    :'daily_spend_cap',
    :'end_time',
    :'is_automated_campaign',
    :'is_flexible_daily_budgets',
    :'lifetime_spend_cap',
    :'order_line_id',
    :'start_time',
    :'tracking_urls',
    :'default_ad_group_budget_in_micro_currency',
    :'is_campaign_budget_optimization',
    :'bid_options',
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'ad_account_id' => :'String',
    :'daily_spend_cap' => :'Integer',
    :'end_time' => :'Integer',
    :'is_automated_campaign' => :'Boolean',
    :'is_flexible_daily_budgets' => :'Boolean',
    :'lifetime_spend_cap' => :'Integer',
    :'name' => :'String',
    :'order_line_id' => :'String',
    :'start_time' => :'Integer',
    :'status' => :'EntityStatus',
    :'tracking_urls' => :'TrackingUrls',
    :'default_ad_group_budget_in_micro_currency' => :'Integer',
    :'is_campaign_budget_optimization' => :'Boolean',
    :'id' => :'String',
    :'bid_options' => :'CampaignBidOptions',
    :'created_time' => :'Integer',
    :'is_performance_plus' => :'Boolean',
    :'objective_type' => :'ObjectiveType',
    :'summary_status' => :'CampaignSummaryStatus',
    :'type' => :'String',
    :'updated_time' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      daily_spend_cap == o.daily_spend_cap &&
      end_time == o.end_time &&
      is_automated_campaign == o.is_automated_campaign &&
      is_flexible_daily_budgets == o.is_flexible_daily_budgets &&
      lifetime_spend_cap == o.lifetime_spend_cap &&
      name == o.name &&
      order_line_id == o.order_line_id &&
      start_time == o.start_time &&
      status == o.status &&
      tracking_urls == o.tracking_urls &&
      default_ad_group_budget_in_micro_currency == o.default_ad_group_budget_in_micro_currency &&
      is_campaign_budget_optimization == o.is_campaign_budget_optimization &&
      id == o.id &&
      bid_options == o.bid_options &&
      created_time == o.created_time &&
      is_performance_plus == o.is_performance_plus &&
      objective_type == o.objective_type &&
      summary_status == o.summary_status &&
      type == o.type &&
      updated_time == o.updated_time
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


392
393
394
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 392

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



398
399
400
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 398

def hash
  [, daily_spend_cap, end_time, is_automated_campaign, is_flexible_daily_budgets, lifetime_spend_cap, name, order_line_id, start_time, status, tracking_urls, default_ad_group_budget_in_micro_currency, is_campaign_budget_optimization, id, bid_options, created_time, is_performance_plus, objective_type, summary_status, type, updated_time].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 290

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^\d+$/)
  if !@ad_account_id.nil? && @ad_account_id !~ pattern
    invalid_properties.push("invalid value for \"ad_account_id\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^\d+$/)
  if !@id.nil? && @id !~ pattern
    invalid_properties.push("invalid value for \"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



427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 427

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



313
314
315
316
317
318
319
# File 'lib/pinterest_sdk/models/campaign_create_response_data.rb', line 313

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@ad_account_id.nil? && @ad_account_id !~ Regexp.new(/^\d+$/)
  return false if !@order_line_id.nil? && @order_line_id !~ Regexp.new(/^\d+$/)
  return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
  true
end