Class: MistApi::ReplaceDevice

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

Overview

ReplaceDevice 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(discard = SKIP, inventory_mac = SKIP, mac = SKIP, site_id = SKIP, tunterm_port_config = SKIP, additional_properties = nil) ⇒ ReplaceDevice

Returns a new instance of ReplaceDevice.



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

def initialize(discard = SKIP, inventory_mac = SKIP, mac = SKIP,
               site_id = SKIP, tunterm_port_config = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @discard = discard unless discard == SKIP
  @inventory_mac = inventory_mac unless inventory_mac == SKIP
  @mac = mac unless mac == SKIP
  @site_id = site_id unless site_id == SKIP
  @tunterm_port_config = tunterm_port_config unless tunterm_port_config == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#discardArray[String]

Attributes that you don’t want to copy

Returns:

  • (Array[String])


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

def discard
  @discard
end

#inventory_macString

MAC Address of the inventory that will be replacing the old one. It has to be claimed and unassigned

Returns:

  • (String)


19
20
21
# File 'lib/mist_api/models/replace_device.rb', line 19

def inventory_mac
  @inventory_mac
end

#macString

MAC Address of the device to replace

Returns:

  • (String)


23
24
25
# File 'lib/mist_api/models/replace_device.rb', line 23

def mac
  @mac
end

#site_idString

Site_id of the device to be replaced

Returns:

  • (String)


27
28
29
# File 'lib/mist_api/models/replace_device.rb', line 27

def site_id
  @site_id
end

#tunterm_port_configTuntermPortConfig

Ethernet port configurations

Returns:



31
32
33
# File 'lib/mist_api/models/replace_device.rb', line 31

def tunterm_port_config
  @tunterm_port_config
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
100
# File 'lib/mist_api/models/replace_device.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  discard = hash.key?('discard') ? hash['discard'] : SKIP
  inventory_mac = hash.key?('inventory_mac') ? hash['inventory_mac'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  tunterm_port_config = TuntermPortConfig.from_hash(hash['tunterm_port_config']) if
    hash['tunterm_port_config']

  # 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.
  ReplaceDevice.new(discard,
                    inventory_mac,
                    mac,
                    site_id,
                    tunterm_port_config,
                    additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/mist_api/models/replace_device.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['discard'] = 'discard'
  @_hash['inventory_mac'] = 'inventory_mac'
  @_hash['mac'] = 'mac'
  @_hash['site_id'] = 'site_id'
  @_hash['tunterm_port_config'] = 'tunterm_port_config'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/mist_api/models/replace_device.rb', line 45

def self.optionals
  %w[
    discard
    inventory_mac
    mac
    site_id
    tunterm_port_config
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
# File 'lib/mist_api/models/replace_device.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} discard: #{@discard.inspect}, inventory_mac: #{@inventory_mac.inspect},"\
  " mac: #{@mac.inspect}, site_id: #{@site_id.inspect}, tunterm_port_config:"\
  " #{@tunterm_port_config.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
108
# File 'lib/mist_api/models/replace_device.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} discard: #{@discard}, inventory_mac: #{@inventory_mac}, mac: #{@mac},"\
  " site_id: #{@site_id}, tunterm_port_config: #{@tunterm_port_config}, additional_properties:"\
  " #{@additional_properties}>"
end