Class: Zernio::CreateHighDemandPeriodRequest

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

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
171
172
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 113

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Zernio SocialAccount id used to resolve the Meta token.



19
20
21
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 19

def 
  @account_id
end

#ad_set_idObject

Platform ad set id. Exactly one of campaignId / adSetId.



25
26
27
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 25

def ad_set_id
  @ad_set_id
end

#budget_valueObject

With ABSOLUTE, a budget in the ad account's currency in WHOLE units (50 = $50.00). With MULTIPLIER, a factor of the existing budget (2 = double it) and NOT a currency amount.



28
29
30
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 28

def budget_value
  @budget_value
end

#budget_value_typeObject

Returns the value of attribute budget_value_type.



30
31
32
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 30

def budget_value_type
  @budget_value_type
end

#campaign_idObject

Platform campaign id. Exactly one of campaignId / adSetId.



22
23
24
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 22

def campaign_id
  @campaign_id
end

#currencyObject

Ad account currency, for the ABSOLUTE minor-unit conversion. Ignored for MULTIPLIER.



41
42
43
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 41

def currency
  @currency
end

#recurrence_typeObject

Returns the value of attribute recurrence_type.



38
39
40
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 38

def recurrence_type
  @recurrence_type
end

#time_endObject

Unix seconds, on a 15-minute boundary and after timeStart.



36
37
38
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 36

def time_end
  @time_end
end

#time_startObject

Unix seconds, on a 15-minute boundary (:00, :15, :30, :45).



33
34
35
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 33

def time_start
  @time_start
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



81
82
83
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 81

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



86
87
88
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 86

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
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 66

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'campaign_id' => :'campaignId',
    :'ad_set_id' => :'adSetId',
    :'budget_value' => :'budgetValue',
    :'budget_value_type' => :'budgetValueType',
    :'time_start' => :'timeStart',
    :'time_end' => :'timeEnd',
    :'recurrence_type' => :'recurrenceType',
    :'currency' => :'currency'
  }
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



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 309

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



106
107
108
109
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 106

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

.openapi_typesObject

Attribute type mapping.



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 91

def self.openapi_types
  {
    :'account_id' => :'String',
    :'campaign_id' => :'String',
    :'ad_set_id' => :'String',
    :'budget_value' => :'Float',
    :'budget_value_type' => :'String',
    :'time_start' => :'Integer',
    :'time_end' => :'Integer',
    :'recurrence_type' => :'String',
    :'currency' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      campaign_id == o.campaign_id &&
      ad_set_id == o.ad_set_id &&
      budget_value == o.budget_value &&
      budget_value_type == o.budget_value_type &&
      time_start == o.time_start &&
      time_end == o.time_end &&
      recurrence_type == o.recurrence_type &&
      currency == o.currency
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


296
297
298
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 296

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



302
303
304
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 302

def hash
  [, campaign_id, ad_set_id, budget_value, budget_value_type, time_start, time_end, recurrence_type, currency].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 176

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 331

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



204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/zernio-sdk/models/create_high_demand_period_request.rb', line 204

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @budget_value.nil?
  return false if @budget_value_type.nil?
  budget_value_type_validator = EnumAttributeValidator.new('String', ["ABSOLUTE", "MULTIPLIER"])
  return false unless budget_value_type_validator.valid?(@budget_value_type)
  return false if @time_start.nil?
  return false if @time_end.nil?
  recurrence_type_validator = EnumAttributeValidator.new('String', ["ONE_TIME", "WEEKLY", "MONTHLY"])
  return false unless recurrence_type_validator.valid?(@recurrence_type)
  true
end