Class: MistApi::SpectrumAnalysis

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

Overview

SpectrumAnalysis 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(band = nil, channels = SKIP, device_id = SKIP, duration = 300, format = SpectrumAnalysisFormatEnum::JSON, additional_properties = nil) ⇒ SpectrumAnalysis

Returns a new instance of SpectrumAnalysis.



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

def initialize(band = nil, channels = SKIP, device_id = SKIP,
               duration = 300, format = SpectrumAnalysisFormatEnum::JSON,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @band = band
  @channels = channels unless channels == SKIP
  @device_id = device_id unless device_id == SKIP
  @duration = duration unless duration == SKIP
  @format = format unless format == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bandSpectrumAnalysisBandEnum

Band for spectrum analysis. enum: ‘24`, `5`, `6`



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

def band
  @band
end

#channelsArray[String]

Optional list of channels to scan. If not specified, all supported channels will be scanned

Returns:

  • (Array[String])


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

def channels
  @channels
end

#device_idUUID | String

Device ID of the AP that is performing spectrum analysis

Returns:

  • (UUID | String)


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

def device_id
  @device_id
end

#durationInteger

Duration of the spectrum analysis in seconds

Returns:

  • (Integer)


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

def duration
  @duration
end

#formatSpectrumAnalysisFormatEnum

Format of the spectrum analysis data. enum: ‘json`, `stream`



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

def format
  @format
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/mist_api/models/spectrum_analysis.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  band = hash.key?('band') ? hash['band'] : nil
  channels = hash.key?('channels') ? hash['channels'] : SKIP
  device_id = hash.key?('device_id') ? hash['device_id'] : SKIP
  duration = hash['duration'] ||= 300
  format = hash['format'] ||= SpectrumAnalysisFormatEnum::JSON

  # 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.
  SpectrumAnalysis.new(band,
                       channels,
                       device_id,
                       duration,
                       format,
                       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/spectrum_analysis.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['band'] = 'band'
  @_hash['channels'] = 'channels'
  @_hash['device_id'] = 'device_id'
  @_hash['duration'] = 'duration'
  @_hash['format'] = 'format'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/mist_api/models/spectrum_analysis.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    channels
    device_id
    duration
    format
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/mist_api/models/spectrum_analysis.rb', line 108

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} band: #{@band.inspect}, channels: #{@channels.inspect}, device_id:"\
  " #{@device_id.inspect}, duration: #{@duration.inspect}, format: #{@format.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/mist_api/models/spectrum_analysis.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} band: #{@band}, channels: #{@channels}, device_id: #{@device_id}, duration:"\
  " #{@duration}, format: #{@format}, additional_properties: #{@additional_properties}>"
end