Class: PinterestSdkClient::TemplateResponse

Inherits:
ApiModelBase show all
Defined in:
lib/pinterest_sdk/models/template_response.rb

Overview

Template fields

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_account_idObject

ID of the Ad Account that owns the template



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

def 
  @ad_account_id
end

#ad_account_idsObject

IDs of the Ad Accounts that have access to this template



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

def 
  @ad_account_ids
end

#click_window_daysObject

The length of the sliding window over which click conversions will be attributed



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

def click_window_days
  @click_window_days
end

#columnsObject

A list of columns to be included in the report



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

def columns
  @columns
end

#conversion_report_time_typeObject

Conversion report time type



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

def conversion_report_time_type
  @conversion_report_time_type
end

#creation_sourceObject

The surface used to create this template



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

def creation_source
  @creation_source
end

#custom_column_idsObject

A list of custom column IDs



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

def custom_column_ids
  @custom_column_ids
end

#date_rangeObject

Returns the value of attribute date_range.



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

def date_range
  @date_range
end

#engagement_window_daysObject

The length of the sliding window over which engagement conversions will be attributed



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

def engagement_window_days
  @engagement_window_days
end

#filters_jsonObject

A JSON representation of any filters to be applied before returning report data. Each filter object should contain all of the following fields:
"field": The column name
"operator": The operator. Allowed operators: ["=", "!=", "in", "not_in", "~", ">", "<", "contains_substring"]
"value": A single value or a list of values



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

def filters_json
  @filters_json
end

#granularityObject

Returns the value of attribute granularity.



48
49
50
# File 'lib/pinterest_sdk/models/template_response.rb', line 48

def granularity
  @granularity
end

#idObject

Template ID



51
52
53
# File 'lib/pinterest_sdk/models/template_response.rb', line 51

def id
  @id
end

#ingestion_sourcesObject

The filter on the conversion ingestion source method for conversion metrics



54
55
56
# File 'lib/pinterest_sdk/models/template_response.rb', line 54

def ingestion_sources
  @ingestion_sources
end

#is_deletedObject

A boolean that indicates if the template has been deleted



57
58
59
# File 'lib/pinterest_sdk/models/template_response.rb', line 57

def is_deleted
  @is_deleted
end

#is_owned_by_userObject

A boolean value that indicates if the user owns the template



60
61
62
# File 'lib/pinterest_sdk/models/template_response.rb', line 60

def is_owned_by_user
  @is_owned_by_user
end

#is_scheduledObject

A boolean value that indicates if this template has been used to create a scheduled report



63
64
65
# File 'lib/pinterest_sdk/models/template_response.rb', line 63

def is_scheduled
  @is_scheduled
end

#nameObject

Template Name



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

def name
  @name
end

#report_end_relative_days_in_pastObject

The number of days prior to the day the report will be delivered at which the report will end



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

def report_end_relative_days_in_past
  @report_end_relative_days_in_past
end

#report_formatObject

Returns the value of attribute report_format.



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

def report_format
  @report_format
end

#report_levelObject

Returns the value of attribute report_level.



73
74
75
# File 'lib/pinterest_sdk/models/template_response.rb', line 73

def report_level
  @report_level
end

#report_start_relative_days_in_pastObject

The number of days prior to the day the report will be delivered at which the report will start



76
77
78
# File 'lib/pinterest_sdk/models/template_response.rb', line 76

def report_start_relative_days_in_past
  @report_start_relative_days_in_past
end

#typeObject

Reporting template type



79
80
81
# File 'lib/pinterest_sdk/models/template_response.rb', line 79

def type
  @type
end

#updated_timeObject

Time of last update in seconds since Unix epoch



82
83
84
# File 'lib/pinterest_sdk/models/template_response.rb', line 82

def updated_time
  @updated_time
end

#user_idObject

ID of the user who created the template



85
86
87
# File 'lib/pinterest_sdk/models/template_response.rb', line 85

def user_id
  @user_id
end

#view_window_daysObject

The length of the sliding window over which view conversions will be attributed



88
89
90
# File 'lib/pinterest_sdk/models/template_response.rb', line 88

def view_window_days
  @view_window_days
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



144
145
146
# File 'lib/pinterest_sdk/models/template_response.rb', line 144

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



149
150
151
# File 'lib/pinterest_sdk/models/template_response.rb', line 149

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/pinterest_sdk/models/template_response.rb', line 113

def self.attribute_map
  {
    :'ad_account_id' => :'ad_account_id',
    :'ad_account_ids' => :'ad_account_ids',
    :'click_window_days' => :'click_window_days',
    :'columns' => :'columns',
    :'conversion_report_time_type' => :'conversion_report_time_type',
    :'creation_source' => :'creation_source',
    :'custom_column_ids' => :'custom_column_ids',
    :'date_range' => :'date_range',
    :'engagement_window_days' => :'engagement_window_days',
    :'filters_json' => :'filters_json',
    :'granularity' => :'granularity',
    :'id' => :'id',
    :'ingestion_sources' => :'ingestion_sources',
    :'is_deleted' => :'is_deleted',
    :'is_owned_by_user' => :'is_owned_by_user',
    :'is_scheduled' => :'is_scheduled',
    :'name' => :'name',
    :'report_end_relative_days_in_past' => :'report_end_relative_days_in_past',
    :'report_format' => :'report_format',
    :'report_level' => :'report_level',
    :'report_start_relative_days_in_past' => :'report_start_relative_days_in_past',
    :'type' => :'type',
    :'updated_time' => :'updated_time',
    :'user_id' => :'user_id',
    :'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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/pinterest_sdk/models/template_response.rb', line 418

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



185
186
187
188
189
190
191
192
193
# File 'lib/pinterest_sdk/models/template_response.rb', line 185

def self.openapi_nullable
  Set.new([
    :'custom_column_ids',
    :'filters_json',
    :'ingestion_sources',
    :'is_deleted',
    :'name',
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'ad_account_id' => :'String',
    :'ad_account_ids' => :'Array<String>',
    :'click_window_days' => :'Float',
    :'columns' => :'Array<String>',
    :'conversion_report_time_type' => :'String',
    :'creation_source' => :'String',
    :'custom_column_ids' => :'Array<String>',
    :'date_range' => :'TemplateResponseDateRange',
    :'engagement_window_days' => :'Float',
    :'filters_json' => :'String',
    :'granularity' => :'Granularity',
    :'id' => :'String',
    :'ingestion_sources' => :'Array<String>',
    :'is_deleted' => :'Boolean',
    :'is_owned_by_user' => :'Boolean',
    :'is_scheduled' => :'Boolean',
    :'name' => :'String',
    :'report_end_relative_days_in_past' => :'Float',
    :'report_format' => :'DataOutputFormat',
    :'report_level' => :'MetricsReportingLevel',
    :'report_start_relative_days_in_past' => :'Float',
    :'type' => :'String',
    :'updated_time' => :'Float',
    :'user_id' => :'String',
    :'view_window_days' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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/template_response.rb', line 373

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      click_window_days == o.click_window_days &&
      columns == o.columns &&
      conversion_report_time_type == o.conversion_report_time_type &&
      creation_source == o.creation_source &&
      custom_column_ids == o.custom_column_ids &&
      date_range == o.date_range &&
      engagement_window_days == o.engagement_window_days &&
      filters_json == o.filters_json &&
      granularity == o.granularity &&
      id == o.id &&
      ingestion_sources == o.ingestion_sources &&
      is_deleted == o.is_deleted &&
      is_owned_by_user == o.is_owned_by_user &&
      is_scheduled == o.is_scheduled &&
      name == o.name &&
      report_end_relative_days_in_past == o.report_end_relative_days_in_past &&
      report_format == o.report_format &&
      report_level == o.report_level &&
      report_start_relative_days_in_past == o.report_start_relative_days_in_past &&
      type == o.type &&
      updated_time == o.updated_time &&
      user_id == o.user_id &&
      view_window_days == o.view_window_days
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


405
406
407
# File 'lib/pinterest_sdk/models/template_response.rb', line 405

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



411
412
413
# File 'lib/pinterest_sdk/models/template_response.rb', line 411

def hash
  [, , click_window_days, columns, conversion_report_time_type, creation_source, custom_column_ids, date_range, engagement_window_days, filters_json, granularity, id, ingestion_sources, is_deleted, is_owned_by_user, is_scheduled, name, report_end_relative_days_in_past, report_format, report_level, report_start_relative_days_in_past, type, updated_time, user_id, 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



322
323
324
325
326
# File 'lib/pinterest_sdk/models/template_response.rb', line 322

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



440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/pinterest_sdk/models/template_response.rb', line 440

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



330
331
332
333
334
335
336
337
338
339
# File 'lib/pinterest_sdk/models/template_response.rb', line 330

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  conversion_report_time_type_validator = EnumAttributeValidator.new('String', ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"])
  return false unless conversion_report_time_type_validator.valid?(@conversion_report_time_type)
  creation_source_validator = EnumAttributeValidator.new('String', ["ADS_API", "ADS_MANAGER_REPORTING_PAGE", "ADS_MANAGER_REPORT_BUILDER"])
  return false unless creation_source_validator.valid?(@creation_source)
  type_validator = EnumAttributeValidator.new('String', ["UNSPECIFIED", "BULK", "OVERVIEW", "TABLE"])
  return false unless type_validator.valid?(@type)
  true
end