Class: MistApi::UserMac

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

Overview

UserMac 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(mac = nil, id = SKIP, labels = SKIP, name = SKIP, notes = SKIP, radius_group = SKIP, vlan = SKIP, additional_properties = nil) ⇒ UserMac

Returns a new instance of UserMac.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mist_api/models/user_mac.rb', line 70

def initialize(mac = nil, id = SKIP, labels = SKIP, name = SKIP,
               notes = SKIP, radius_group = SKIP, vlan = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @labels = labels unless labels == SKIP
  @mac = mac
  @name = name unless name == SKIP
  @notes = notes unless notes == SKIP
  @radius_group = radius_group unless radius_group == SKIP
  @vlan = vlan unless vlan == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#labelsArray[String]

Unique ID of the object instance in the Mist Organization

Returns:

  • (Array[String])


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

def labels
  @labels
end

#macString

Only non-local-admin MAC is accepted

Returns:

  • (String)


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

def mac
  @mac
end

#nameString

Only non-local-admin MAC is accepted

Returns:

  • (String)


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

def name
  @name
end

#notesString

Only non-local-admin MAC is accepted

Returns:

  • (String)


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

def notes
  @notes
end

#radius_groupString

Only non-local-admin MAC is accepted

Returns:

  • (String)


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

def radius_group
  @radius_group
end

#vlanString

Only non-local-admin MAC is accepted

Returns:

  • (String)


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

def vlan
  @vlan
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/mist_api/models/user_mac.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mac = hash.key?('mac') ? hash['mac'] : nil
  id = hash.key?('id') ? hash['id'] : SKIP
  labels = hash.key?('labels') ? hash['labels'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  notes = hash.key?('notes') ? hash['notes'] : SKIP
  radius_group = hash.key?('radius_group') ? hash['radius_group'] : SKIP
  vlan = hash.key?('vlan') ? hash['vlan'] : 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.
  UserMac.new(mac,
              id,
              labels,
              name,
              notes,
              radius_group,
              vlan,
              additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mist_api/models/user_mac.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['labels'] = 'labels'
  @_hash['mac'] = 'mac'
  @_hash['name'] = 'name'
  @_hash['notes'] = 'notes'
  @_hash['radius_group'] = 'radius_group'
  @_hash['vlan'] = 'vlan'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/mist_api/models/user_mac.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
# File 'lib/mist_api/models/user_mac.rb', line 54

def self.optionals
  %w[
    id
    labels
    name
    notes
    radius_group
    vlan
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
# File 'lib/mist_api/models/user_mac.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, labels: #{@labels.inspect}, mac: #{@mac.inspect}, name:"\
  " #{@name.inspect}, notes: #{@notes.inspect}, radius_group: #{@radius_group.inspect}, vlan:"\
  " #{@vlan.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
123
# File 'lib/mist_api/models/user_mac.rb', line 118

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, labels: #{@labels}, mac: #{@mac}, name: #{@name}, notes:"\
  " #{@notes}, radius_group: #{@radius_group}, vlan: #{@vlan}, additional_properties:"\
  " #{@additional_properties}>"
end