Class: MistApi::UserApitoken
- Defined in:
- lib/mist_api/models/user_apitoken.rb
Overview
User API Token
Instance Attribute Summary collapse
-
#created_time ⇒ Float
When the object has been created, in epoch.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#key ⇒ String
Unique ID of the object instance in the Mist Organization.
-
#last_used ⇒ Integer
Unique ID of the object instance in the Mist Organization.
-
#name ⇒ String
Name of the token.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(created_time = SKIP, id = SKIP, key = SKIP, last_used = SKIP, name = SKIP, additional_properties = nil) ⇒ UserApitoken
constructor
A new instance of UserApitoken.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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, id = SKIP, key = SKIP, last_used = SKIP, name = SKIP, additional_properties = nil) ⇒ UserApitoken
Returns a new instance of UserApitoken.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/mist_api/models/user_apitoken.rb', line 61 def initialize(created_time = SKIP, id = SKIP, key = SKIP, last_used = SKIP, name = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @created_time = created_time unless created_time == SKIP @id = id unless id == SKIP @key = key unless key == SKIP @last_used = last_used unless last_used == SKIP @name = name unless name == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#created_time ⇒ Float
When the object has been created, in epoch
14 15 16 |
# File 'lib/mist_api/models/user_apitoken.rb', line 14 def created_time @created_time end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
18 19 20 |
# File 'lib/mist_api/models/user_apitoken.rb', line 18 def id @id end |
#key ⇒ String
Unique ID of the object instance in the Mist Organization
22 23 24 |
# File 'lib/mist_api/models/user_apitoken.rb', line 22 def key @key end |
#last_used ⇒ Integer
Unique ID of the object instance in the Mist Organization
26 27 28 |
# File 'lib/mist_api/models/user_apitoken.rb', line 26 def last_used @last_used end |
#name ⇒ String
Name of the token
30 31 32 |
# File 'lib/mist_api/models/user_apitoken.rb', line 30 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/mist_api/models/user_apitoken.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. created_time = hash.key?('created_time') ? hash['created_time'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP key = hash.key?('key') ? hash['key'] : SKIP last_used = hash.key?('last_used') ? hash['last_used'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. UserApitoken.new(created_time, id, key, last_used, name, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/mist_api/models/user_apitoken.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['created_time'] = 'created_time' @_hash['id'] = 'id' @_hash['key'] = 'key' @_hash['last_used'] = 'last_used' @_hash['name'] = 'name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 58 59 |
# File 'lib/mist_api/models/user_apitoken.rb', line 55 def self.nullables %w[ last_used ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/mist_api/models/user_apitoken.rb', line 44 def self.optionals %w[ created_time id key last_used name ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/mist_api/models/user_apitoken.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time.inspect}, id: #{@id.inspect}, key:"\ " #{@key.inspect}, last_used: #{@last_used.inspect}, name: #{@name.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
102 103 104 105 106 |
# File 'lib/mist_api/models/user_apitoken.rb', line 102 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time}, id: #{@id}, key: #{@key}, last_used:"\ " #{@last_used}, name: #{@name}, additional_properties: #{@additional_properties}>" end |