Class: stcloud::DayUsageData

Inherits:
Object
  • Object
show all
Defined in:
lib/stcloud/models/day_usage_data.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DayUsageData

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
185
186
187
188
189
190
191
192
193
194
195
196
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
# File 'lib/stcloud/models/day_usage_data.rb', line 138

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `stcloud::DayUsageData` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `stcloud::DayUsageData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#count_daily_data_pointsObject

Returns the value of attribute count_daily_data_points.



16
17
18
# File 'lib/stcloud/models/day_usage_data.rb', line 16

def count_daily_data_points
  @count_daily_data_points
end

#dayObject

Returns the value of attribute day.



18
19
20
# File 'lib/stcloud/models/day_usage_data.rb', line 18

def day
  @day
end

#discountObject

Returns the value of attribute discount.



20
21
22
# File 'lib/stcloud/models/day_usage_data.rb', line 20

def discount
  @discount
end

#dpm_per_container_host_quotaObject

Returns the value of attribute dpm_per_container_host_quota.



22
23
24
# File 'lib/stcloud/models/day_usage_data.rb', line 22

def dpm_per_container_host_quota
  @dpm_per_container_host_quota
end

#dpm_per_host_quotaObject

Returns the value of attribute dpm_per_host_quota.



24
25
26
# File 'lib/stcloud/models/day_usage_data.rb', line 24

def dpm_per_host_quota
  @dpm_per_host_quota
end

#fixed_monthly_priceObject

Returns the value of attribute fixed_monthly_price.



26
27
28
# File 'lib/stcloud/models/day_usage_data.rb', line 26

def fixed_monthly_price
  @fixed_monthly_price
end

#fixed_monthly_price_per_hourObject

Returns the value of attribute fixed_monthly_price_per_hour.



28
29
30
# File 'lib/stcloud/models/day_usage_data.rb', line 28

def fixed_monthly_price_per_hour
  @fixed_monthly_price_per_hour
end

#free_containers_per_hostObject

Returns the value of attribute free_containers_per_host.



30
31
32
# File 'lib/stcloud/models/day_usage_data.rb', line 30

def free_containers_per_host
  @free_containers_per_host
end

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/stcloud/models/day_usage_data.rb', line 32

def id
  @id
end

#kilo_dpm_overage_price_per_hourObject

Returns the value of attribute kilo_dpm_overage_price_per_hour.



34
35
36
# File 'lib/stcloud/models/day_usage_data.rb', line 34

def kilo_dpm_overage_price_per_hour
  @kilo_dpm_overage_price_per_hour
end

#plan_typeObject

Returns the value of attribute plan_type.



36
37
38
# File 'lib/stcloud/models/day_usage_data.rb', line 36

def plan_type
  @plan_type
end

#price_per_container_host_hourObject

Returns the value of attribute price_per_container_host_hour.



38
39
40
# File 'lib/stcloud/models/day_usage_data.rb', line 38

def price_per_container_host_hour
  @price_per_container_host_hour
end

#price_per_container_hourObject

Returns the value of attribute price_per_container_hour.



40
41
42
# File 'lib/stcloud/models/day_usage_data.rb', line 40

def price_per_container_hour
  @price_per_container_hour
end

#price_per_server_hourObject

Returns the value of attribute price_per_server_hour.



42
43
44
# File 'lib/stcloud/models/day_usage_data.rb', line 42

def price_per_server_hour
  @price_per_server_hour
end

#sum_number_of_container_hostsObject

Returns the value of attribute sum_number_of_container_hosts.



44
45
46
# File 'lib/stcloud/models/day_usage_data.rb', line 44

def sum_number_of_container_hosts
  @sum_number_of_container_hosts
end

#sum_number_of_containersObject

Returns the value of attribute sum_number_of_containers.



46
47
48
# File 'lib/stcloud/models/day_usage_data.rb', line 46

def sum_number_of_containers
  @sum_number_of_containers
end

#sum_number_of_serversObject

Returns the value of attribute sum_number_of_servers.



48
49
50
# File 'lib/stcloud/models/day_usage_data.rb', line 48

def sum_number_of_servers
  @sum_number_of_servers
end

#usage_amountObject

Returns the value of attribute usage_amount.



50
51
52
# File 'lib/stcloud/models/day_usage_data.rb', line 50

def usage_amount
  @usage_amount
end

#used_planObject

Returns the value of attribute used_plan.



52
53
54
# File 'lib/stcloud/models/day_usage_data.rb', line 52

def used_plan
  @used_plan
end

#user_discountObject

Returns the value of attribute user_discount.



54
55
56
# File 'lib/stcloud/models/day_usage_data.rb', line 54

def user_discount
  @user_discount
end

Class Method Details

.attribute_mapObject

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



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/stcloud/models/day_usage_data.rb', line 79

def self.attribute_map
  {
    :'count_daily_data_points' => :'countDailyDataPoints',
    :'day' => :'day',
    :'discount' => :'discount',
    :'dpm_per_container_host_quota' => :'dpmPerContainerHostQuota',
    :'dpm_per_host_quota' => :'dpmPerHostQuota',
    :'fixed_monthly_price' => :'fixedMonthlyPrice',
    :'fixed_monthly_price_per_hour' => :'fixedMonthlyPricePerHour',
    :'free_containers_per_host' => :'freeContainersPerHost',
    :'id' => :'id',
    :'kilo_dpm_overage_price_per_hour' => :'kiloDpmOveragePricePerHour',
    :'plan_type' => :'planType',
    :'price_per_container_host_hour' => :'pricePerContainerHostHour',
    :'price_per_container_hour' => :'pricePerContainerHour',
    :'price_per_server_hour' => :'pricePerServerHour',
    :'sum_number_of_container_hosts' => :'sumNumberOfContainerHosts',
    :'sum_number_of_containers' => :'sumNumberOfContainers',
    :'sum_number_of_servers' => :'sumNumberOfServers',
    :'usage_amount' => :'usageAmount',
    :'used_plan' => :'usedPlan',
    :'user_discount' => :'userDiscount'
  }
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



299
300
301
# File 'lib/stcloud/models/day_usage_data.rb', line 299

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



131
132
133
134
# File 'lib/stcloud/models/day_usage_data.rb', line 131

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

.openapi_typesObject

Attribute type mapping.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/stcloud/models/day_usage_data.rb', line 105

def self.openapi_types
  {
    :'count_daily_data_points' => :'Object',
    :'day' => :'Object',
    :'discount' => :'Object',
    :'dpm_per_container_host_quota' => :'Object',
    :'dpm_per_host_quota' => :'Object',
    :'fixed_monthly_price' => :'Object',
    :'fixed_monthly_price_per_hour' => :'Object',
    :'free_containers_per_host' => :'Object',
    :'id' => :'Object',
    :'kilo_dpm_overage_price_per_hour' => :'Object',
    :'plan_type' => :'Object',
    :'price_per_container_host_hour' => :'Object',
    :'price_per_container_hour' => :'Object',
    :'price_per_server_hour' => :'Object',
    :'sum_number_of_container_hosts' => :'Object',
    :'sum_number_of_containers' => :'Object',
    :'sum_number_of_servers' => :'Object',
    :'usage_amount' => :'Object',
    :'used_plan' => :'Object',
    :'user_discount' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/stcloud/models/day_usage_data.rb', line 259

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      count_daily_data_points == o.count_daily_data_points &&
      day == o.day &&
      discount == o.discount &&
      dpm_per_container_host_quota == o.dpm_per_container_host_quota &&
      dpm_per_host_quota == o.dpm_per_host_quota &&
      fixed_monthly_price == o.fixed_monthly_price &&
      fixed_monthly_price_per_hour == o.fixed_monthly_price_per_hour &&
      free_containers_per_host == o.free_containers_per_host &&
      id == o.id &&
      kilo_dpm_overage_price_per_hour == o.kilo_dpm_overage_price_per_hour &&
      plan_type == o.plan_type &&
      price_per_container_host_hour == o.price_per_container_host_hour &&
      price_per_container_hour == o.price_per_container_hour &&
      price_per_server_hour == o.price_per_server_hour &&
      sum_number_of_container_hosts == o.sum_number_of_container_hosts &&
      sum_number_of_containers == o.sum_number_of_containers &&
      sum_number_of_servers == o.sum_number_of_servers &&
      usage_amount == o.usage_amount &&
      used_plan == o.used_plan &&
      user_discount == o.user_discount
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/stcloud/models/day_usage_data.rb', line 329

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    stcloud.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/stcloud/models/day_usage_data.rb', line 398

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/stcloud/models/day_usage_data.rb', line 306

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if 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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


286
287
288
# File 'lib/stcloud/models/day_usage_data.rb', line 286

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



292
293
294
# File 'lib/stcloud/models/day_usage_data.rb', line 292

def hash
  [count_daily_data_points, day, discount, dpm_per_container_host_quota, dpm_per_host_quota, fixed_monthly_price, fixed_monthly_price_per_hour, free_containers_per_host, id, kilo_dpm_overage_price_per_hour, plan_type, price_per_container_host_hour, price_per_container_hour, price_per_server_hour, sum_number_of_container_hosts, sum_number_of_containers, sum_number_of_servers, usage_amount, used_plan, user_discount].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



234
235
236
237
# File 'lib/stcloud/models/day_usage_data.rb', line 234

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



374
375
376
# File 'lib/stcloud/models/day_usage_data.rb', line 374

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/stcloud/models/day_usage_data.rb', line 380

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



368
369
370
# File 'lib/stcloud/models/day_usage_data.rb', line 368

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



241
242
243
244
245
# File 'lib/stcloud/models/day_usage_data.rb', line 241

def valid?
  plan_type_validator = EnumAttributeValidator.new('Object', ['INFRA', 'PER_AGENT', 'FIXED_PRICE', 'PER_VOLUME'])
  return false unless plan_type_validator.valid?(@plan_type)
  true
end