Class: PinterestSdkClient::AdGroupDeliveryEstimates

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

Overview

Ad group configuration for delivery estimates.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

  if attributes.key?(:'placement_group')
    self.placement_group = attributes[:'placement_group']
  else
    self.placement_group = 'ALL'
  end

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

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

Instance Attribute Details

#auto_targeting_enabledObject

Returns the value of attribute auto_targeting_enabled.



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

def auto_targeting_enabled
  @auto_targeting_enabled
end

#creative_typesObject

Pin creative types filter. Note: SHOP_THE_PIN has been deprecated. Please use COLLECTION instead.



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

def creative_types
  @creative_types
end

#keywordsObject

Array of keyword objects. If the keywords field is missing, all keywords will be targeted.



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

def keywords
  @keywords
end

#monthly_frequency_capObject

Set a limit to the number of times a promoted pin from this campaign can be impressed by a pinner within the past rolling 30 days. Only available for CPM (cost per mille (1000 impressions)) ad groups.



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

def monthly_frequency_cap
  @monthly_frequency_cap
end

#optimization_goal_metadataObject

Returns the value of attribute optimization_goal_metadata.



30
31
32
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 30

def 
  
end

#optimization_typeObject

Optimization type for ad group delivery. Defaults to WEB_CONVERSION for WEB_CONVERSION/AWARENESS objectives, CLICKTHROUGH otherwise.



33
34
35
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 33

def optimization_type
  @optimization_type
end

#placement_groupObject

Returns the value of attribute placement_group.



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

def placement_group
  @placement_group
end

#product_group_idsObject

Targeted product group IDs Note: This can only be combined with shopping/catalog sales campaigns.



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

def product_group_ids
  @product_group_ids
end

#targeting_specObject

Returns the value of attribute targeting_spec.



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

def targeting_spec
  @targeting_spec
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



80
81
82
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 80

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 65

def self.attribute_map
  {
    :'auto_targeting_enabled' => :'auto_targeting_enabled',
    :'creative_types' => :'creative_types',
    :'keywords' => :'keywords',
    :'monthly_frequency_cap' => :'monthly_frequency_cap',
    :'optimization_goal_metadata' => :'optimization_goal_metadata',
    :'optimization_type' => :'optimization_type',
    :'placement_group' => :'placement_group',
    :'product_group_ids' => :'product_group_ids',
    :'targeting_spec' => :'targeting_spec'
  }
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



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 237

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



105
106
107
108
109
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 105

def self.openapi_nullable
  Set.new([
    :'keywords',
  ])
end

.openapi_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 90

def self.openapi_types
  {
    :'auto_targeting_enabled' => :'Boolean',
    :'creative_types' => :'Array<AdGroupAudienceSizingCreativeTypes>',
    :'keywords' => :'Array<AdGroupDeliveryEstimatesKeywordsItems>',
    :'monthly_frequency_cap' => :'Integer',
    :'optimization_goal_metadata' => :'OptimizationGoalMetadata',
    :'optimization_type' => :'OptimizationType',
    :'placement_group' => :'PlacementGroupType',
    :'product_group_ids' => :'Array<String>',
    :'targeting_spec' => :'TargetingSpecOptimal'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 208

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      auto_targeting_enabled == o.auto_targeting_enabled &&
      creative_types == o.creative_types &&
      keywords == o.keywords &&
      monthly_frequency_cap == o.monthly_frequency_cap &&
       == o. &&
      optimization_type == o.optimization_type &&
      placement_group == o.placement_group &&
      product_group_ids == o.product_group_ids &&
      targeting_spec == o.targeting_spec
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


224
225
226
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 224

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



230
231
232
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 230

def hash
  [auto_targeting_enabled, creative_types, keywords, monthly_frequency_cap, , optimization_type, placement_group, product_group_ids, targeting_spec].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



174
175
176
177
178
179
180
181
182
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 174

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@monthly_frequency_cap.nil? && @monthly_frequency_cap < 0
    invalid_properties.push('invalid value for "monthly_frequency_cap", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 259

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



186
187
188
189
190
# File 'lib/pinterest_sdk/models/ad_group_delivery_estimates.rb', line 186

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@monthly_frequency_cap.nil? && @monthly_frequency_cap < 0
  true
end