Class: Late::AdTreeCampaign

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/ad_tree_campaign.rb

Overview

Campaign with nested ad sets and rolled-up metrics

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 121

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



39
40
41
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 39

def 
  @account_id
end

#ad_countObject

Total ads across all ad sets



29
30
31
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 29

def ad_count
  @ad_count
end

#ad_set_countObject

Returns the value of attribute ad_set_count.



31
32
33
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 31

def ad_set_count
  @ad_set_count
end

#ad_setsObject

Returns the value of attribute ad_sets.



43
44
45
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 43

def ad_sets
  @ad_sets
end

#budgetObject

Returns the value of attribute budget.



33
34
35
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 33

def budget
  @budget
end

#campaign_nameObject

Returns the value of attribute campaign_name.



23
24
25
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 23

def campaign_name
  @campaign_name
end

#metricsObject

Returns the value of attribute metrics.



35
36
37
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 35

def metrics
  @metrics
end

#platformObject

Returns the value of attribute platform.



21
22
23
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 21

def platform
  @platform
end

#platform_ad_account_idObject

Returns the value of attribute platform_ad_account_id.



37
38
39
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 37

def 
  @platform_ad_account_id
end

#platform_campaign_idObject

Returns the value of attribute platform_campaign_id.



19
20
21
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 19

def platform_campaign_id
  @platform_campaign_id
end

#profile_idObject

Returns the value of attribute profile_id.



41
42
43
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 41

def profile_id
  @profile_id
end

#statusObject

Derived from child ad statuses



26
27
28
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 26

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



86
87
88
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 86

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 68

def self.attribute_map
  {
    :'platform_campaign_id' => :'platformCampaignId',
    :'platform' => :'platform',
    :'campaign_name' => :'campaignName',
    :'status' => :'status',
    :'ad_count' => :'adCount',
    :'ad_set_count' => :'adSetCount',
    :'budget' => :'budget',
    :'metrics' => :'metrics',
    :'platform_ad_account_id' => :'platformAdAccountId',
    :'account_id' => :'accountId',
    :'profile_id' => :'profileId',
    :'ad_sets' => :'adSets'
  }
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



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 259

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



114
115
116
117
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 114

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

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 96

def self.openapi_types
  {
    :'platform_campaign_id' => :'String',
    :'platform' => :'String',
    :'campaign_name' => :'String',
    :'status' => :'String',
    :'ad_count' => :'Integer',
    :'ad_set_count' => :'Integer',
    :'budget' => :'AdBudget',
    :'metrics' => :'AdMetrics',
    :'platform_ad_account_id' => :'String',
    :'account_id' => :'String',
    :'profile_id' => :'String',
    :'ad_sets' => :'Array<AdTreeAdSet>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 227

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      platform_campaign_id == o.platform_campaign_id &&
      platform == o.platform &&
      campaign_name == o.campaign_name &&
      status == o.status &&
      ad_count == o.ad_count &&
      ad_set_count == o.ad_set_count &&
      budget == o.budget &&
      metrics == o.metrics &&
       == o. &&
       == o. &&
      profile_id == o.profile_id &&
      ad_sets == o.ad_sets
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


246
247
248
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 246

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



252
253
254
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 252

def hash
  [platform_campaign_id, platform, campaign_name, status, ad_count, ad_set_count, budget, metrics, , , profile_id, ad_sets].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



188
189
190
191
192
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 188

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



281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 281

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



196
197
198
199
200
201
202
203
# File 'lib/late-sdk/models/ad_tree_campaign.rb', line 196

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  platform_validator = EnumAttributeValidator.new('String', ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"])
  return false unless platform_validator.valid?(@platform)
  status_validator = EnumAttributeValidator.new('String', ["active", "paused", "pending_review", "rejected", "completed", "cancelled", "error"])
  return false unless status_validator.valid?(@status)
  true
end