Class: MistApi::MarvisClient

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

Overview

MarvisClient 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(disabled = false, enrollment_url = SKIP, id = SKIP, location = SKIP, name = SKIP, synthetic_test = SKIP, telemetry = SKIP, additional_properties = nil) ⇒ MarvisClient

Returns a new instance of MarvisClient.



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

def initialize(disabled = false, enrollment_url = SKIP, id = SKIP,
               location = SKIP, name = SKIP, synthetic_test = SKIP,
               telemetry = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @disabled = disabled unless disabled == SKIP
  @enrollment_url = enrollment_url unless enrollment_url == SKIP
  @id = id unless id == SKIP
  @location = location unless location == SKIP
  @name = name unless name == SKIP
  @synthetic_test = synthetic_test unless synthetic_test == SKIP
  @telemetry = telemetry unless telemetry == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#disabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def disabled
  @disabled
end

#enrollment_urlString

In MDM, add ‘–enrollment_url <enrollment_url>` to the install command

Returns:

  • (String)


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

def enrollment_url
  @enrollment_url
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#locationMarvisClientLocation

Unique ID of the object instance in the Mist Organization



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

def location
  @location
end

#nameString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


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

def name
  @name
end

#synthetic_testMarvisClientSyntheticTest

Unique ID of the object instance in the Mist Organization



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

def synthetic_test
  @synthetic_test
end

#telemetryMarvisClientTelemetry

Note: some stats are not collected when it’s not connected to Mist infrastructure



39
40
41
# File 'lib/mist_api/models/marvis_client.rb', line 39

def telemetry
  @telemetry
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
116
117
118
119
# File 'lib/mist_api/models/marvis_client.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  disabled = hash['disabled'] ||= false
  enrollment_url =
    hash.key?('enrollment_url') ? hash['enrollment_url'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  location = MarvisClientLocation.from_hash(hash['location']) if hash['location']
  name = hash.key?('name') ? hash['name'] : SKIP
  synthetic_test = MarvisClientSyntheticTest.from_hash(hash['synthetic_test']) if
    hash['synthetic_test']
  telemetry = MarvisClientTelemetry.from_hash(hash['telemetry']) if hash['telemetry']

  # 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.
  MarvisClient.new(disabled,
                   enrollment_url,
                   id,
                   location,
                   name,
                   synthetic_test,
                   telemetry,
                   additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['disabled'] = 'disabled'
  @_hash['enrollment_url'] = 'enrollment_url'
  @_hash['id'] = 'id'
  @_hash['location'] = 'location'
  @_hash['name'] = 'name'
  @_hash['synthetic_test'] = 'synthetic_test'
  @_hash['telemetry'] = 'telemetry'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/mist_api/models/marvis_client.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    disabled
    enrollment_url
    id
    location
    name
    synthetic_test
    telemetry
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
136
# File 'lib/mist_api/models/marvis_client.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} disabled: #{@disabled.inspect}, enrollment_url: #{@enrollment_url.inspect},"\
  " id: #{@id.inspect}, location: #{@location.inspect}, name: #{@name.inspect},"\
  " synthetic_test: #{@synthetic_test.inspect}, telemetry: #{@telemetry.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
# File 'lib/mist_api/models/marvis_client.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} disabled: #{@disabled}, enrollment_url: #{@enrollment_url}, id: #{@id},"\
  " location: #{@location}, name: #{@name}, synthetic_test: #{@synthetic_test}, telemetry:"\
  " #{@telemetry}, additional_properties: #{@additional_properties}>"
end