Class: MistApi::ClaimActivation

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

Overview

ClaimActivation 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(code = nil, type = ClaimTypeEnum::ALL, async = false, device_type = DeviceTypeDefaultApEnum::AP, additional_properties = nil) ⇒ ClaimActivation

Returns a new instance of ClaimActivation.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/mist_api/models/claim_activation.rb', line 51

def initialize(code = nil, type = ClaimTypeEnum::ALL, async = false,
               device_type = DeviceTypeDefaultApEnum::AP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @async = async unless async == SKIP
  @code = code
  @device_type = device_type unless device_type == SKIP
  @type = type
  @additional_properties = additional_properties
end

Instance Attribute Details

#asyncTrueClass | FalseClass

Whether to do a async claim process

Returns:

  • (TrueClass | FalseClass)


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

def async
  @async
end

#codeString

Activation code

Returns:

  • (String)


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

def code
  @code
end

#device_typeDeviceTypeDefaultApEnum

enum: ‘ap`, `gateway`, `switch`



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

def device_type
  @device_type
end

#typeClaimTypeEnum

what to claim. enum: ‘all`, `inventory`, `license`

Returns:



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/mist_api/models/claim_activation.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : nil
  type = hash['type'] ||= ClaimTypeEnum::ALL
  async = hash['async'] ||= false
  device_type = hash['device_type'] ||= DeviceTypeDefaultApEnum::AP

  # 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.
  ClaimActivation.new(code,
                      type,
                      async,
                      device_type,
                      additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/mist_api/models/claim_activation.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['async'] = 'async'
  @_hash['code'] = 'code'
  @_hash['device_type'] = 'device_type'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/mist_api/models/claim_activation.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
# File 'lib/mist_api/models/claim_activation.rb', line 39

def self.optionals
  %w[
    async
    device_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
102
# File 'lib/mist_api/models/claim_activation.rb', line 97

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} async: #{@async.inspect}, code: #{@code.inspect}, device_type:"\
  " #{@device_type.inspect}, type: #{@type.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
# File 'lib/mist_api/models/claim_activation.rb', line 90

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} async: #{@async}, code: #{@code}, device_type: #{@device_type}, type:"\
  " #{@type}, additional_properties: #{@additional_properties}>"
end