Class: Lockally::BillingStatus

Inherits:
ApiModelBase show all
Defined in:
lib/lockally/models/billing_status.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 = {}) ⇒ BillingStatus

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/lockally/models/billing_status.rb', line 130

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#catalogObject

Returns the value of attribute catalog.



46
47
48
# File 'lib/lockally/models/billing_status.rb', line 46

def catalog
  @catalog
end

#created_atObject

Returns the value of attribute created_at.



38
39
40
# File 'lib/lockally/models/billing_status.rb', line 38

def created_at
  @created_at
end

#current_period_endObject

Returns the value of attribute current_period_end.



36
37
38
# File 'lib/lockally/models/billing_status.rb', line 36

def current_period_end
  @current_period_end
end

#display_nameObject

Returns the value of attribute display_name.



20
21
22
# File 'lib/lockally/models/billing_status.rb', line 20

def display_name
  @display_name
end

#modeObject

Returns the value of attribute mode.



22
23
24
# File 'lib/lockally/models/billing_status.rb', line 22

def mode
  @mode
end

#monthly_included_sendsObject

Returns the value of attribute monthly_included_sends.



26
27
28
# File 'lib/lockally/models/billing_status.rb', line 26

def monthly_included_sends
  @monthly_included_sends
end

#msgs_this_periodObject

Returns the value of attribute msgs_this_period.



28
29
30
# File 'lib/lockally/models/billing_status.rb', line 28

def msgs_this_period
  @msgs_this_period
end

#planObject

Returns the value of attribute plan.



18
19
20
# File 'lib/lockally/models/billing_status.rb', line 18

def plan
  @plan
end

#price_naira_per_seatObject

Returns the value of attribute price_naira_per_seat.



32
33
34
# File 'lib/lockally/models/billing_status.rb', line 32

def price_naira_per_seat
  @price_naira_per_seat
end

#rate_cap_per_minObject

Returns the value of attribute rate_cap_per_min.



24
25
26
# File 'lib/lockally/models/billing_status.rb', line 24

def rate_cap_per_min
  @rate_cap_per_min
end

#send_units_balanceObject

Returns the value of attribute send_units_balance.



40
41
42
# File 'lib/lockally/models/billing_status.rb', line 40

def send_units_balance
  @send_units_balance
end

#send_units_next_expiryObject

Returns the value of attribute send_units_next_expiry.



42
43
44
# File 'lib/lockally/models/billing_status.rb', line 42

def send_units_next_expiry
  @send_units_next_expiry
end

#statusObject

Returns the value of attribute status.



30
31
32
# File 'lib/lockally/models/billing_status.rb', line 30

def status
  @status
end

#subscribed_atObject

Returns the value of attribute subscribed_at.



34
35
36
# File 'lib/lockally/models/billing_status.rb', line 34

def subscribed_at
  @subscribed_at
end

#unit_bundlesObject

Returns the value of attribute unit_bundles.



44
45
46
# File 'lib/lockally/models/billing_status.rb', line 44

def unit_bundles
  @unit_bundles
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



92
93
94
# File 'lib/lockally/models/billing_status.rb', line 92

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



97
98
99
# File 'lib/lockally/models/billing_status.rb', line 97

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/lockally/models/billing_status.rb', line 71

def self.attribute_map
  {
    :'plan' => :'plan',
    :'display_name' => :'display_name',
    :'mode' => :'mode',
    :'rate_cap_per_min' => :'rate_cap_per_min',
    :'monthly_included_sends' => :'monthly_included_sends',
    :'msgs_this_period' => :'msgs_this_period',
    :'status' => :'status',
    :'price_naira_per_seat' => :'price_naira_per_seat',
    :'subscribed_at' => :'subscribed_at',
    :'current_period_end' => :'current_period_end',
    :'created_at' => :'created_at',
    :'send_units_balance' => :'send_units_balance',
    :'send_units_next_expiry' => :'send_units_next_expiry',
    :'unit_bundles' => :'unit_bundles',
    :'catalog' => :'catalog'
  }
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



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

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



123
124
125
126
# File 'lib/lockally/models/billing_status.rb', line 123

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

.openapi_typesObject

Attribute type mapping.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/lockally/models/billing_status.rb', line 102

def self.openapi_types
  {
    :'plan' => :'String',
    :'display_name' => :'String',
    :'mode' => :'String',
    :'rate_cap_per_min' => :'Integer',
    :'monthly_included_sends' => :'Integer',
    :'msgs_this_period' => :'Integer',
    :'status' => :'String',
    :'price_naira_per_seat' => :'Integer',
    :'subscribed_at' => :'Time',
    :'current_period_end' => :'Time',
    :'created_at' => :'Time',
    :'send_units_balance' => :'Integer',
    :'send_units_next_expiry' => :'Time',
    :'unit_bundles' => :'Array<UnitBundle>',
    :'catalog' => :'Array<PlanCatalogEntry>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/lockally/models/billing_status.rb', line 434

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      plan == o.plan &&
      display_name == o.display_name &&
      mode == o.mode &&
      rate_cap_per_min == o.rate_cap_per_min &&
      monthly_included_sends == o.monthly_included_sends &&
      msgs_this_period == o.msgs_this_period &&
      status == o.status &&
      price_naira_per_seat == o.price_naira_per_seat &&
      subscribed_at == o.subscribed_at &&
      current_period_end == o.current_period_end &&
      created_at == o.created_at &&
      send_units_balance == o.send_units_balance &&
      send_units_next_expiry == o.send_units_next_expiry &&
      unit_bundles == o.unit_bundles &&
      catalog == o.catalog
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


456
457
458
# File 'lib/lockally/models/billing_status.rb', line 456

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



462
463
464
# File 'lib/lockally/models/billing_status.rb', line 462

def hash
  [plan, display_name, mode, rate_cap_per_min, monthly_included_sends, msgs_this_period, status, price_naira_per_seat, subscribed_at, current_period_end, created_at, send_units_balance, send_units_next_expiry, unit_bundles, catalog].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



235
236
237
238
239
240
241
242
243
244
245
246
247
248
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
# File 'lib/lockally/models/billing_status.rb', line 235

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

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

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

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

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

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

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

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

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

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

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

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



491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/lockally/models/billing_status.rb', line 491

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



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/lockally/models/billing_status.rb', line 291

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @plan.nil?
  return false if @display_name.nil?
  return false if @mode.nil?
  mode_validator = EnumAttributeValidator.new('String', ["api", "business", "both"])
  return false unless mode_validator.valid?(@mode)
  return false if @rate_cap_per_min.nil?
  return false if @monthly_included_sends.nil?
  return false if @msgs_this_period.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["active", "suspended"])
  return false unless status_validator.valid?(@status)
  return false if @price_naira_per_seat.nil?
  return false if @created_at.nil?
  return false if @send_units_balance.nil?
  return false if @unit_bundles.nil?
  return false if @catalog.nil?
  true
end