Class: MistApi::AppProbing

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

Overview

AppProbing 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(apps = SKIP, custom_apps = SKIP, enabled = SKIP) ⇒ AppProbing

Returns a new instance of AppProbing.



50
51
52
53
54
# File 'lib/mist_api/models/app_probing.rb', line 50

def initialize(apps = SKIP, custom_apps = SKIP, enabled = SKIP)
  @apps = apps unless apps == SKIP
  @custom_apps = custom_apps unless custom_apps == SKIP
  @enabled = enabled unless enabled == SKIP
end

Instance Attribute Details

#appsArray[String]

APp-keys from [List Applications]($e/Constants%20Definitions/listApplications)

Returns:

  • (Array[String])


15
16
17
# File 'lib/mist_api/models/app_probing.rb', line 15

def apps
  @apps
end

#custom_appsArray[AppProbingCustomApp]

APp-keys from [List Applications]($e/Constants%20Definitions/listApplications)

Returns:



20
21
22
# File 'lib/mist_api/models/app_probing.rb', line 20

def custom_apps
  @custom_apps
end

#enabledTrueClass | FalseClass

APp-keys from [List Applications]($e/Constants%20Definitions/listApplications)

Returns:

  • (TrueClass | FalseClass)


25
26
27
# File 'lib/mist_api/models/app_probing.rb', line 25

def enabled
  @enabled
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/mist_api/models/app_probing.rb', line 57

def self.from_hash(hash)
  return nil unless hash

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

  custom_apps = SKIP unless hash.key?('custom_apps')
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP

  # Create object from extracted values.
  AppProbing.new(apps,
                 custom_apps,
                 enabled)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/mist_api/models/app_probing.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['apps'] = 'apps'
  @_hash['custom_apps'] = 'custom_apps'
  @_hash['enabled'] = 'enabled'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/mist_api/models/app_probing.rb', line 37

def self.optionals
  %w[
    apps
    custom_apps
    enabled
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/mist_api/models/app_probing.rb', line 87

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} apps: #{@apps.inspect}, custom_apps: #{@custom_apps.inspect}, enabled:"\
  " #{@enabled.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



81
82
83
84
# File 'lib/mist_api/models/app_probing.rb', line 81

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} apps: #{@apps}, custom_apps: #{@custom_apps}, enabled: #{@enabled}>"
end