Class: RelentlessIdentity::ClientUsageResponse

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/relentless_identity/models/client_usage_response.rb

Overview

Current authenticated account usage, free-tier windows, and paid balance snapshot.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/relentless_identity/models/client_usage_response.rb', line 134

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#billing_cycle_value_microsObject

Returns the value of attribute billing_cycle_value_micros.



40
41
42
# File 'lib/relentless_identity/models/client_usage_response.rb', line 40

def billing_cycle_value_micros
  @billing_cycle_value_micros
end

#billing_extra_value_microsObject

Returns the value of attribute billing_extra_value_micros.



42
43
44
# File 'lib/relentless_identity/models/client_usage_response.rb', line 42

def billing_extra_value_micros
  @billing_extra_value_micros
end

#billing_modeObject

Returns the value of attribute billing_mode.



22
23
24
# File 'lib/relentless_identity/models/client_usage_response.rb', line 22

def billing_mode
  @billing_mode
end

#billing_statusObject

Returns the value of attribute billing_status.



24
25
26
# File 'lib/relentless_identity/models/client_usage_response.rb', line 24

def billing_status
  @billing_status
end

#billing_value_micros_remainingObject

Returns the value of attribute billing_value_micros_remaining.



49
50
51
# File 'lib/relentless_identity/models/client_usage_response.rb', line 49

def billing_value_micros_remaining
  @billing_value_micros_remaining
end

#billing_value_micros_reservedObject

Paid usage value currently reserved by queued or running background jobs.



47
48
49
# File 'lib/relentless_identity/models/client_usage_response.rb', line 47

def billing_value_micros_reserved
  @billing_value_micros_reserved
end

#billing_value_micros_usedObject

Returns the value of attribute billing_value_micros_used.



44
45
46
# File 'lib/relentless_identity/models/client_usage_response.rb', line 44

def billing_value_micros_used
  @billing_value_micros_used
end

#current_plan_finder_deliverable_cost_microsObject

Returns the value of attribute current_plan_finder_deliverable_cost_micros.



53
54
55
# File 'lib/relentless_identity/models/client_usage_response.rb', line 53

def current_plan_finder_deliverable_cost_micros
  @current_plan_finder_deliverable_cost_micros
end

#current_plan_finder_undeliverable_cost_microsObject

Returns the value of attribute current_plan_finder_undeliverable_cost_micros.



55
56
57
# File 'lib/relentless_identity/models/client_usage_response.rb', line 55

def current_plan_finder_undeliverable_cost_micros
  @current_plan_finder_undeliverable_cost_micros
end

#current_plan_probe_cost_microsObject

Returns the value of attribute current_plan_probe_cost_micros.



57
58
59
# File 'lib/relentless_identity/models/client_usage_response.rb', line 57

def current_plan_probe_cost_micros
  @current_plan_probe_cost_micros
end

#free_weekly_limitObject

Returns the value of attribute free_weekly_limit.



30
31
32
# File 'lib/relentless_identity/models/client_usage_response.rb', line 30

def free_weekly_limit
  @free_weekly_limit
end

#free_window_hoursObject

Returns the value of attribute free_window_hours.



28
29
30
# File 'lib/relentless_identity/models/client_usage_response.rb', line 28

def free_window_hours
  @free_window_hours
end

#free_window_limitObject

Returns the value of attribute free_window_limit.



26
27
28
# File 'lib/relentless_identity/models/client_usage_response.rb', line 26

def free_window_limit
  @free_window_limit
end

#plan_tierObject

Current plan family, such as free or paid.



20
21
22
# File 'lib/relentless_identity/models/client_usage_response.rb', line 20

def plan_tier
  @plan_tier
end

#usage_percent_remainingObject

Returns the value of attribute usage_percent_remaining.



51
52
53
# File 'lib/relentless_identity/models/client_usage_response.rb', line 51

def usage_percent_remaining
  @usage_percent_remaining
end

#weekly_requests_remainingObject

Returns the value of attribute weekly_requests_remaining.



38
39
40
# File 'lib/relentless_identity/models/client_usage_response.rb', line 38

def weekly_requests_remaining
  @weekly_requests_remaining
end

#weekly_requests_usedObject

Returns the value of attribute weekly_requests_used.



34
35
36
# File 'lib/relentless_identity/models/client_usage_response.rb', line 34

def weekly_requests_used
  @weekly_requests_used
end

#window_requests_remainingObject

Returns the value of attribute window_requests_remaining.



36
37
38
# File 'lib/relentless_identity/models/client_usage_response.rb', line 36

def window_requests_remaining
  @window_requests_remaining
end

#window_requests_usedObject

Returns the value of attribute window_requests_used.



32
33
34
# File 'lib/relentless_identity/models/client_usage_response.rb', line 32

def window_requests_used
  @window_requests_used
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



85
86
87
# File 'lib/relentless_identity/models/client_usage_response.rb', line 85

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



90
91
92
# File 'lib/relentless_identity/models/client_usage_response.rb', line 90

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/relentless_identity/models/client_usage_response.rb', line 60

def self.attribute_map
  {
    :'plan_tier' => :'plan_tier',
    :'billing_mode' => :'billing_mode',
    :'billing_status' => :'billing_status',
    :'free_window_limit' => :'free_window_limit',
    :'free_window_hours' => :'free_window_hours',
    :'free_weekly_limit' => :'free_weekly_limit',
    :'window_requests_used' => :'window_requests_used',
    :'weekly_requests_used' => :'weekly_requests_used',
    :'window_requests_remaining' => :'window_requests_remaining',
    :'weekly_requests_remaining' => :'weekly_requests_remaining',
    :'billing_cycle_value_micros' => :'billing_cycle_value_micros',
    :'billing_extra_value_micros' => :'billing_extra_value_micros',
    :'billing_value_micros_used' => :'billing_value_micros_used',
    :'billing_value_micros_reserved' => :'billing_value_micros_reserved',
    :'billing_value_micros_remaining' => :'billing_value_micros_remaining',
    :'usage_percent_remaining' => :'usage_percent_remaining',
    :'current_plan_finder_deliverable_cost_micros' => :'current_plan_finder_deliverable_cost_micros',
    :'current_plan_finder_undeliverable_cost_micros' => :'current_plan_finder_undeliverable_cost_micros',
    :'current_plan_probe_cost_micros' => :'current_plan_probe_cost_micros'
  }
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



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/relentless_identity/models/client_usage_response.rb', line 468

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



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/relentless_identity/models/client_usage_response.rb', line 120

def self.openapi_nullable
  Set.new([
    :'billing_status',
    :'billing_cycle_value_micros',
    :'billing_value_micros_remaining',
    :'usage_percent_remaining',
    :'current_plan_finder_deliverable_cost_micros',
    :'current_plan_finder_undeliverable_cost_micros',
    :'current_plan_probe_cost_micros'
  ])
end

.openapi_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/relentless_identity/models/client_usage_response.rb', line 95

def self.openapi_types
  {
    :'plan_tier' => :'String',
    :'billing_mode' => :'String',
    :'billing_status' => :'String',
    :'free_window_limit' => :'Integer',
    :'free_window_hours' => :'Integer',
    :'free_weekly_limit' => :'Integer',
    :'window_requests_used' => :'Integer',
    :'weekly_requests_used' => :'Integer',
    :'window_requests_remaining' => :'Integer',
    :'weekly_requests_remaining' => :'Integer',
    :'billing_cycle_value_micros' => :'Integer',
    :'billing_extra_value_micros' => :'Integer',
    :'billing_value_micros_used' => :'Integer',
    :'billing_value_micros_reserved' => :'Integer',
    :'billing_value_micros_remaining' => :'Integer',
    :'usage_percent_remaining' => :'Float',
    :'current_plan_finder_deliverable_cost_micros' => :'Integer',
    :'current_plan_finder_undeliverable_cost_micros' => :'Integer',
    :'current_plan_probe_cost_micros' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/relentless_identity/models/client_usage_response.rb', line 429

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      plan_tier == o.plan_tier &&
      billing_mode == o.billing_mode &&
      billing_status == o.billing_status &&
      free_window_limit == o.free_window_limit &&
      free_window_hours == o.free_window_hours &&
      free_weekly_limit == o.free_weekly_limit &&
      window_requests_used == o.window_requests_used &&
      weekly_requests_used == o.weekly_requests_used &&
      window_requests_remaining == o.window_requests_remaining &&
      weekly_requests_remaining == o.weekly_requests_remaining &&
      billing_cycle_value_micros == o.billing_cycle_value_micros &&
      billing_extra_value_micros == o.billing_extra_value_micros &&
      billing_value_micros_used == o.billing_value_micros_used &&
      billing_value_micros_reserved == o.billing_value_micros_reserved &&
      billing_value_micros_remaining == o.billing_value_micros_remaining &&
      usage_percent_remaining == o.usage_percent_remaining &&
      current_plan_finder_deliverable_cost_micros == o.current_plan_finder_deliverable_cost_micros &&
      current_plan_finder_undeliverable_cost_micros == o.current_plan_finder_undeliverable_cost_micros &&
      current_plan_probe_cost_micros == o.current_plan_probe_cost_micros
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


455
456
457
# File 'lib/relentless_identity/models/client_usage_response.rb', line 455

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



461
462
463
# File 'lib/relentless_identity/models/client_usage_response.rb', line 461

def hash
  [plan_tier, billing_mode, billing_status, free_window_limit, free_window_hours, free_weekly_limit, window_requests_used, weekly_requests_used, window_requests_remaining, weekly_requests_remaining, billing_cycle_value_micros, billing_extra_value_micros, billing_value_micros_used, billing_value_micros_reserved, billing_value_micros_remaining, usage_percent_remaining, current_plan_finder_deliverable_cost_micros, current_plan_finder_undeliverable_cost_micros, current_plan_probe_cost_micros].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/relentless_identity/models/client_usage_response.rb', line 249

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

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

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

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

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

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

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

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

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

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

  if @billing_value_micros_used.nil?
    invalid_properties.push('invalid value for "billing_value_micros_used", billing_value_micros_used 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



490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/relentless_identity/models/client_usage_response.rb', line 490

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



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/relentless_identity/models/client_usage_response.rb', line 301

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @plan_tier.nil?
  return false if @billing_mode.nil?
  return false if @free_window_limit.nil?
  return false if @free_window_hours.nil?
  return false if @free_weekly_limit.nil?
  return false if @window_requests_used.nil?
  return false if @weekly_requests_used.nil?
  return false if @window_requests_remaining.nil?
  return false if @weekly_requests_remaining.nil?
  return false if @billing_extra_value_micros.nil?
  return false if @billing_value_micros_used.nil?
  true
end