Class: PinterestSdkClient::ConversionProductReportCreate

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

Overview

Resource create operation model.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
240
241
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 146

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_group_idsObject

List of ad group ids. Only support ad_group_ids field when level of the report is AD_GROUP.



20
21
22
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 20

def ad_group_ids
  @ad_group_ids
end

#campaign_idsObject

List of campaign ids. Only support campaign_ids field when level of the report is CAMPAIGN.



23
24
25
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 23

def campaign_ids
  @campaign_ids
end

#campaign_objective_typesObject

List of values for filtering. Default is ['CONSIDERATION','AWARENESS','WEB_CONVERSION','VIDEO_COMPLETION'].



26
27
28
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 26

def campaign_objective_types
  @campaign_objective_types
end

#click_window_daysObject

Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to 30 days.



29
30
31
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 29

def click_window_days
  @click_window_days
end

#columnsObject

Metric and entity columns



32
33
34
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 32

def columns
  @columns
end

#conversion_product_attribution_typeObject

Required attribution type of the B/C/S report. When the attribution type is BRAND_ATTRIBUTION, start_date for the report must be after 2025-04-01.



35
36
37
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 35

def conversion_product_attribution_type
  @conversion_product_attribution_type
end

#conversion_product_breakdownObject

Report breakdown type. This is used to specify the breakdown of the report by brand, category, or SKU.



38
39
40
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 38

def conversion_product_breakdown
  @conversion_product_breakdown
end

#conversion_report_timeObject

The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.



41
42
43
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 41

def conversion_report_time
  @conversion_report_time
end

#end_dateObject

Metric report end date (UTC). Format: YYYY-MM-DD. A max of 1 year is allowed between the start and end date for reports.



44
45
46
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 44

def end_date
  @end_date
end

#granularityObject

Report granularity for time-based metric aggregation



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

def granularity
  @granularity
end

#levelObject

Level of the report



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

def level
  @level
end

#product_sku_idsObject

List of SKU ids. Only support product_sku_ids field when report breakdown type is PRODUCT_SKU_GROUP.



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

def product_sku_ids
  @product_sku_ids
end

#report_nameObject

Name of the conversion product report



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

def report_name
  @report_name
end

#start_dateObject

Metric report start date (UTC). Format: YYYY-MM-DD. Start date must be after 2024-03-16. 7 day minimum time window for report is required.



59
60
61
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 59

def start_date
  @start_date
end

#view_window_daysObject

Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to 1 day.



62
63
64
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 62

def view_window_days
  @view_window_days
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



108
109
110
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 108

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



113
114
115
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 113

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 87

def self.attribute_map
  {
    :'ad_group_ids' => :'ad_group_ids',
    :'campaign_ids' => :'campaign_ids',
    :'campaign_objective_types' => :'campaign_objective_types',
    :'click_window_days' => :'click_window_days',
    :'columns' => :'columns',
    :'conversion_product_attribution_type' => :'conversion_product_attribution_type',
    :'conversion_product_breakdown' => :'conversion_product_breakdown',
    :'conversion_report_time' => :'conversion_report_time',
    :'end_date' => :'end_date',
    :'granularity' => :'granularity',
    :'level' => :'level',
    :'product_sku_ids' => :'product_sku_ids',
    :'report_name' => :'report_name',
    :'start_date' => :'start_date',
    :'view_window_days' => :'view_window_days'
  }
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



519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 519

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



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

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

.openapi_typesObject

Attribute type mapping.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 118

def self.openapi_types
  {
    :'ad_group_ids' => :'Array<String>',
    :'campaign_ids' => :'Array<String>',
    :'campaign_objective_types' => :'Array<ConversionObjectiveType>',
    :'click_window_days' => :'ConversionAttributionWindowDays',
    :'columns' => :'Array<ConversionProductReportingColumn>',
    :'conversion_product_attribution_type' => :'ConversionProductAttributionType',
    :'conversion_product_breakdown' => :'ConversionProductReportBreakdownType',
    :'conversion_report_time' => :'ConversionReportTimeType',
    :'end_date' => :'String',
    :'granularity' => :'ConversionProductReportGranularity',
    :'level' => :'ConversionProductReportLevel',
    :'product_sku_ids' => :'Array<String>',
    :'report_name' => :'String',
    :'start_date' => :'String',
    :'view_window_days' => :'ConversionAttributionWindowDays'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 484

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ad_group_ids == o.ad_group_ids &&
      campaign_ids == o.campaign_ids &&
      campaign_objective_types == o.campaign_objective_types &&
      click_window_days == o.click_window_days &&
      columns == o.columns &&
      conversion_product_attribution_type == o.conversion_product_attribution_type &&
      conversion_product_breakdown == o.conversion_product_breakdown &&
      conversion_report_time == o.conversion_report_time &&
      end_date == o.end_date &&
      granularity == o.granularity &&
      level == o.level &&
      product_sku_ids == o.product_sku_ids &&
      report_name == o.report_name &&
      start_date == o.start_date &&
      view_window_days == o.view_window_days
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


506
507
508
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 506

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



512
513
514
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 512

def hash
  [ad_group_ids, campaign_ids, campaign_objective_types, click_window_days, columns, conversion_product_attribution_type, conversion_product_breakdown, conversion_report_time, end_date, granularity, level, product_sku_ids, report_name, start_date, view_window_days].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@ad_group_ids.nil? && @ad_group_ids.length > 500
    invalid_properties.push('invalid value for "ad_group_ids", number of items must be less than or equal to 500.')
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 541

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



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/pinterest_sdk/models/conversion_product_report_create.rb', line 319

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@ad_group_ids.nil? && @ad_group_ids.length > 500
  return false if !@ad_group_ids.nil? && @ad_group_ids.length < 1
  return false if !@campaign_ids.nil? && @campaign_ids.length > 500
  return false if !@campaign_ids.nil? && @campaign_ids.length < 1
  return false if !@campaign_objective_types.nil? && @campaign_objective_types.length > 7
  return false if !@campaign_objective_types.nil? && @campaign_objective_types.length < 1
  return false if @columns.nil?
  return false if @end_date.nil?
  return false if @end_date !~ Regexp.new(/^\d{4}-\d{2}-\d{2}$/)
  return false if @granularity.nil?
  return false if @level.nil?
  return false if !@product_sku_ids.nil? && @product_sku_ids.length > 30000
  return false if !@product_sku_ids.nil? && @product_sku_ids.length < 2
  return false if @report_name.nil?
  return false if @start_date.nil?
  return false if @start_date !~ Regexp.new(/^\d{4}-\d{2}-\d{2}$/)
  true
end