Class: Late::AdCampaign

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/ad_campaign.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 = {}) ⇒ AdCampaign

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
171
172
173
174
175
176
177
178
179
180
# File 'lib/late-sdk/models/ad_campaign.rb', line 119

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



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

def 
  @account_id
end

#ad_countObject

Returns the value of attribute ad_count.



27
28
29
# File 'lib/late-sdk/models/ad_campaign.rb', line 27

def ad_count
  @ad_count
end

#budgetObject

Returns the value of attribute budget.



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

def budget
  @budget
end

#campaign_nameObject

Returns the value of attribute campaign_name.



22
23
24
# File 'lib/late-sdk/models/ad_campaign.rb', line 22

def campaign_name
  @campaign_name
end

#earliest_adObject

Returns the value of attribute earliest_ad.



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

def earliest_ad
  @earliest_ad
end

#latest_adObject

Returns the value of attribute latest_ad.



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

def latest_ad
  @latest_ad
end

#metricsObject

Returns the value of attribute metrics.



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

def metrics
  @metrics
end

#platformObject

Returns the value of attribute platform.



20
21
22
# File 'lib/late-sdk/models/ad_campaign.rb', line 20

def platform
  @platform
end

#platform_ad_account_idObject

Returns the value of attribute platform_ad_account_id.



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

def 
  @platform_ad_account_id
end

#platform_campaign_idObject

Returns the value of attribute platform_campaign_id.



18
19
20
# File 'lib/late-sdk/models/ad_campaign.rb', line 18

def platform_campaign_id
  @platform_campaign_id
end

#profile_idObject

Returns the value of attribute profile_id.



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

def profile_id
  @profile_id
end

#statusObject

Derived from child ad statuses



25
26
27
# File 'lib/late-sdk/models/ad_campaign.rb', line 25

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



84
85
86
# File 'lib/late-sdk/models/ad_campaign.rb', line 84

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



89
90
91
# File 'lib/late-sdk/models/ad_campaign.rb', line 89

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

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



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/late-sdk/models/ad_campaign.rb', line 255

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



112
113
114
115
# File 'lib/late-sdk/models/ad_campaign.rb', line 112

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'platform_campaign_id' => :'String',
    :'platform' => :'String',
    :'campaign_name' => :'String',
    :'status' => :'String',
    :'ad_count' => :'Integer',
    :'budget' => :'AdBudget',
    :'metrics' => :'AdMetrics',
    :'platform_ad_account_id' => :'String',
    :'account_id' => :'String',
    :'profile_id' => :'String',
    :'earliest_ad' => :'Time',
    :'latest_ad' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/late-sdk/models/ad_campaign.rb', line 223

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 &&
      budget == o.budget &&
      metrics == o.metrics &&
       == o. &&
       == o. &&
      profile_id == o.profile_id &&
      earliest_ad == o.earliest_ad &&
      latest_ad == o.latest_ad
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


242
243
244
# File 'lib/late-sdk/models/ad_campaign.rb', line 242

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



248
249
250
# File 'lib/late-sdk/models/ad_campaign.rb', line 248

def hash
  [platform_campaign_id, platform, campaign_name, status, ad_count, budget, metrics, , , profile_id, earliest_ad, latest_ad].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



184
185
186
187
188
# File 'lib/late-sdk/models/ad_campaign.rb', line 184

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



277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/late-sdk/models/ad_campaign.rb', line 277

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



192
193
194
195
196
197
198
199
# File 'lib/late-sdk/models/ad_campaign.rb', line 192

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