Class: MistApi::LicenseSub

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/license_sub.rb

Overview

LicenseSub Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(created_time = SKIP, end_time = SKIP, id = SKIP, modified_time = SKIP, order_id = SKIP, org_id = SKIP, quantity = SKIP, remaining_quantity = SKIP, start_time = SKIP, subscription_id = SKIP, type = SKIP) ⇒ LicenseSub

Returns a new instance of LicenseSub.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/mist_api/models/license_sub.rb', line 97

def initialize(created_time = SKIP, end_time = SKIP, id = SKIP,
               modified_time = SKIP, order_id = SKIP, org_id = SKIP,
               quantity = SKIP, remaining_quantity = SKIP,
               start_time = SKIP, subscription_id = SKIP, type = SKIP)
  @created_time = created_time unless created_time == SKIP
  @end_time = end_time unless end_time == SKIP
  @id = id unless id == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @order_id = order_id unless order_id == SKIP
  @org_id = org_id unless org_id == SKIP
  @quantity = quantity unless quantity == SKIP
  @remaining_quantity = remaining_quantity unless remaining_quantity == SKIP
  @start_time = start_time unless start_time == SKIP
  @subscription_id = subscription_id unless subscription_id == SKIP
  @type = type unless type == SKIP
end

Instance Attribute Details

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


14
15
16
# File 'lib/mist_api/models/license_sub.rb', line 14

def created_time
  @created_time
end

#end_timeInteger

End date of the license term

Returns:

  • (Integer)


18
19
20
# File 'lib/mist_api/models/license_sub.rb', line 18

def end_time
  @end_time
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


22
23
24
# File 'lib/mist_api/models/license_sub.rb', line 22

def id
  @id
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


26
27
28
# File 'lib/mist_api/models/license_sub.rb', line 26

def modified_time
  @modified_time
end

#order_idString

When the object has been modified for the last time, in epoch

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/license_sub.rb', line 30

def order_id
  @order_id
end

#org_idUUID | String

When the object has been modified for the last time, in epoch

Returns:

  • (UUID | String)


34
35
36
# File 'lib/mist_api/models/license_sub.rb', line 34

def org_id
  @org_id
end

#quantityInteger

Number of devices entitled for this license

Returns:

  • (Integer)


38
39
40
# File 'lib/mist_api/models/license_sub.rb', line 38

def quantity
  @quantity
end

#remaining_quantityInteger

Number of licenses left in this subscription

Returns:

  • (Integer)


42
43
44
# File 'lib/mist_api/models/license_sub.rb', line 42

def remaining_quantity
  @remaining_quantity
end

#start_timeInteger

Start date of the license term

Returns:

  • (Integer)


46
47
48
# File 'lib/mist_api/models/license_sub.rb', line 46

def start_time
  @start_time
end

#subscription_idString

Start date of the license term

Returns:

  • (String)


50
51
52
# File 'lib/mist_api/models/license_sub.rb', line 50

def subscription_id
  @subscription_id
end

#typeString

Type of license. The list of supported license type can be retrieve with the [List License Type]($e/Constants%20Definitions/listLicenseTypes) API request.

Returns:

  • (String)


56
57
58
# File 'lib/mist_api/models/license_sub.rb', line 56

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/mist_api/models/license_sub.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  end_time = hash.key?('end_time') ? hash['end_time'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  order_id = hash.key?('order_id') ? hash['order_id'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
  remaining_quantity =
    hash.key?('remaining_quantity') ? hash['remaining_quantity'] : SKIP
  start_time = hash.key?('start_time') ? hash['start_time'] : SKIP
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP

  # Create object from extracted values.
  LicenseSub.new(created_time,
                 end_time,
                 id,
                 modified_time,
                 order_id,
                 org_id,
                 quantity,
                 remaining_quantity,
                 start_time,
                 subscription_id,
                 type)
end

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mist_api/models/license_sub.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_time'] = 'created_time'
  @_hash['end_time'] = 'end_time'
  @_hash['id'] = 'id'
  @_hash['modified_time'] = 'modified_time'
  @_hash['order_id'] = 'order_id'
  @_hash['org_id'] = 'org_id'
  @_hash['quantity'] = 'quantity'
  @_hash['remaining_quantity'] = 'remaining_quantity'
  @_hash['start_time'] = 'start_time'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
# File 'lib/mist_api/models/license_sub.rb', line 93

def self.nullables
  []
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mist_api/models/license_sub.rb', line 76

def self.optionals
  %w[
    created_time
    end_time
    id
    modified_time
    order_id
    org_id
    quantity
    remaining_quantity
    start_time
    subscription_id
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



157
158
159
160
161
162
163
164
# File 'lib/mist_api/models/license_sub.rb', line 157

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time.inspect}, end_time: #{@end_time.inspect}, id:"\
  " #{@id.inspect}, modified_time: #{@modified_time.inspect}, order_id: #{@order_id.inspect},"\
  " org_id: #{@org_id.inspect}, quantity: #{@quantity.inspect}, remaining_quantity:"\
  " #{@remaining_quantity.inspect}, start_time: #{@start_time.inspect}, subscription_id:"\
  " #{@subscription_id.inspect}, type: #{@type.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



148
149
150
151
152
153
154
# File 'lib/mist_api/models/license_sub.rb', line 148

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time}, end_time: #{@end_time}, id: #{@id},"\
  " modified_time: #{@modified_time}, order_id: #{@order_id}, org_id: #{@org_id}, quantity:"\
  " #{@quantity}, remaining_quantity: #{@remaining_quantity}, start_time: #{@start_time},"\
  " subscription_id: #{@subscription_id}, type: #{@type}>"
end