Class: MistApi::ResponsePastSpectrumAnalysisResult

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

Overview

Result of a past spectrum analysis

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 = SKIP, channel_usage = SKIP, fft_samples = SKIP, mac = SKIP, org_id = SKIP, timestamp = SKIP) ⇒ ResponsePastSpectrumAnalysisResult

Returns a new instance of ResponsePastSpectrumAnalysisResult.



65
66
67
68
69
70
71
72
73
# File 'lib/mist_api/models/response_past_spectrum_analysis_result.rb', line 65

def initialize(band = SKIP, channel_usage = SKIP, fft_samples = SKIP,
               mac = SKIP, org_id = SKIP, timestamp = SKIP)
  @band = band unless band == SKIP
  @channel_usage = channel_usage unless channel_usage == SKIP
  @fft_samples = fft_samples unless fft_samples == SKIP
  @mac = mac unless mac == SKIP
  @org_id = org_id unless org_id == SKIP
  @timestamp = timestamp unless timestamp == SKIP
end

Instance Attribute Details

#bandString

Band on which the spectrum analysis was run (e.g., 24, 5, 6)

Returns:

  • (String)


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

def band
  @band
end

#channel_usageArray[ResponsePastSpectrumAnalysisChannelUsage]

Band on which the spectrum analysis was run (e.g., 24, 5, 6)



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

def channel_usage
  @channel_usage
end

#fft_samplesArray[ResponsePastSpectrumAnalysisFftSample]

List of FFT samples for the spectrum analysis



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

def fft_samples
  @fft_samples
end

#macString

MAC Address of the AP that ran the spectrum analysis

Returns:

  • (String)


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

def mac
  @mac
end

#org_idUUID | String

MAC Address of the AP that ran the spectrum analysis

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#timestampInteger

Timestamp when the spectrum analysis was run in epoch seconds

Returns:

  • (Integer)


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

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/mist_api/models/response_past_spectrum_analysis_result.rb', line 76

def self.from_hash(hash)
  return nil unless hash

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

  channel_usage = SKIP unless hash.key?('channel_usage')
  # Parameter is an array, so we need to iterate through it
  fft_samples = nil
  unless hash['fft_samples'].nil?
    fft_samples = []
    hash['fft_samples'].each do |structure|
      fft_samples << (ResponsePastSpectrumAnalysisFftSample.from_hash(structure) if structure)
    end
  end

  fft_samples = SKIP unless hash.key?('fft_samples')
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP

  # Create object from extracted values.
  ResponsePastSpectrumAnalysisResult.new(band,
                                         channel_usage,
                                         fft_samples,
                                         mac,
                                         org_id,
                                         timestamp)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/mist_api/models/response_past_spectrum_analysis_result.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['band'] = 'band'
  @_hash['channel_usage'] = 'channel_usage'
  @_hash['fft_samples'] = 'fft_samples'
  @_hash['mac'] = 'mac'
  @_hash['org_id'] = 'org_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/mist_api/models/response_past_spectrum_analysis_result.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/mist_api/models/response_past_spectrum_analysis_result.rb', line 49

def self.optionals
  %w[
    band
    channel_usage
    fft_samples
    mac
    org_id
    timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} band: #{@band.inspect}, channel_usage: #{@channel_usage.inspect},"\
  " fft_samples: #{@fft_samples.inspect}, mac: #{@mac.inspect}, org_id: #{@org_id.inspect},"\
  " timestamp: #{@timestamp.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
# File 'lib/mist_api/models/response_past_spectrum_analysis_result.rb', line 115

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} band: #{@band}, channel_usage: #{@channel_usage}, fft_samples:"\
  " #{@fft_samples}, mac: #{@mac}, org_id: #{@org_id}, timestamp: #{@timestamp}>"
end