Class: MistApi::InventorySearchResult

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

Overview

InventorySearchResult 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 = SKIP, master = SKIP, members = SKIP, model = SKIP, name = SKIP, org_id = SKIP, serial = SKIP, site_id = SKIP, sku = SKIP, status = SKIP, type = DeviceTypeDefaultApEnum::AP, vc_mac = SKIP, version = SKIP) ⇒ InventorySearchResult

Returns a new instance of InventorySearchResult.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mist_api/models/inventory_search_result.rb', line 107

def initialize(mac = SKIP, master = SKIP, members = SKIP, model = SKIP,
               name = SKIP, org_id = SKIP, serial = SKIP, site_id = SKIP,
               sku = SKIP, status = SKIP,
               type = DeviceTypeDefaultApEnum::AP, vc_mac = SKIP,
               version = SKIP)
  @mac = mac unless mac == SKIP
  @master = master unless master == SKIP
  @members = members unless members == SKIP
  @model = model unless model == SKIP
  @name = name unless name == SKIP
  @org_id = org_id unless org_id == SKIP
  @serial = serial unless serial == SKIP
  @site_id = site_id unless site_id == SKIP
  @sku = sku unless sku == SKIP
  @status = status unless status == SKIP
  @type = type unless type == SKIP
  @vc_mac = vc_mac unless vc_mac == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#macString

TODO: Write general description for this method

Returns:

  • (String)


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

def mac
  @mac
end

#masterTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def master
  @master
end

#membersArray[InventorySearchResultMember]

TODO: Write general description for this method

Returns:



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

def members
  @members
end

#modelString

TODO: Write general description for this method

Returns:

  • (String)


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

def model
  @model
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#org_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#serialString

TODO: Write general description for this method

Returns:

  • (String)


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

def serial
  @serial
end

#site_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#skuString

TODO: Write general description for this method

Returns:

  • (String)


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

def sku
  @sku
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


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

def status
  @status
end

#typeDeviceTypeDefaultApEnum

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



54
55
56
# File 'lib/mist_api/models/inventory_search_result.rb', line 54

def type
  @type
end

#vc_macString

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

Returns:

  • (String)


58
59
60
# File 'lib/mist_api/models/inventory_search_result.rb', line 58

def vc_mac
  @vc_mac
end

#versionString

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

Returns:

  • (String)


62
63
64
# File 'lib/mist_api/models/inventory_search_result.rb', line 62

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/mist_api/models/inventory_search_result.rb', line 128

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  master = hash.key?('master') ? hash['master'] : SKIP
  # Parameter is an array, so we need to iterate through it
  members = nil
  unless hash['members'].nil?
    members = []
    hash['members'].each do |structure|
      members << (InventorySearchResultMember.from_hash(structure) if structure)
    end
  end

  members = SKIP unless hash.key?('members')
  model = hash.key?('model') ? hash['model'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  serial = hash.key?('serial') ? hash['serial'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  sku = hash.key?('sku') ? hash['sku'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  type = hash['type'] ||= DeviceTypeDefaultApEnum::AP
  vc_mac = hash.key?('vc_mac') ? hash['vc_mac'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  InventorySearchResult.new(mac,
                            master,
                            members,
                            model,
                            name,
                            org_id,
                            serial,
                            site_id,
                            sku,
                            status,
                            type,
                            vc_mac,
                            version)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/mist_api/models/inventory_search_result.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mac'] = 'mac'
  @_hash['master'] = 'master'
  @_hash['members'] = 'members'
  @_hash['model'] = 'model'
  @_hash['name'] = 'name'
  @_hash['org_id'] = 'org_id'
  @_hash['serial'] = 'serial'
  @_hash['site_id'] = 'site_id'
  @_hash['sku'] = 'sku'
  @_hash['status'] = 'status'
  @_hash['type'] = 'type'
  @_hash['vc_mac'] = 'vc_mac'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
# File 'lib/mist_api/models/inventory_search_result.rb', line 103

def self.nullables
  []
end

.optionalsObject

An array for optional fields



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/mist_api/models/inventory_search_result.rb', line 84

def self.optionals
  %w[
    mac
    master
    members
    model
    name
    org_id
    serial
    site_id
    sku
    status
    type
    vc_mac
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



180
181
182
183
184
185
186
187
# File 'lib/mist_api/models/inventory_search_result.rb', line 180

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mac: #{@mac.inspect}, master: #{@master.inspect}, members:"\
  " #{@members.inspect}, model: #{@model.inspect}, name: #{@name.inspect}, org_id:"\
  " #{@org_id.inspect}, serial: #{@serial.inspect}, site_id: #{@site_id.inspect}, sku:"\
  " #{@sku.inspect}, status: #{@status.inspect}, type: #{@type.inspect}, vc_mac:"\
  " #{@vc_mac.inspect}, version: #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



172
173
174
175
176
177
# File 'lib/mist_api/models/inventory_search_result.rb', line 172

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mac: #{@mac}, master: #{@master}, members: #{@members}, model: #{@model},"\
  " name: #{@name}, org_id: #{@org_id}, serial: #{@serial}, site_id: #{@site_id}, sku:"\
  " #{@sku}, status: #{@status}, type: #{@type}, vc_mac: #{@vc_mac}, version: #{@version}>"
end