Class: MistApi::ResponsePastSpectrumAnalysisChannelUsage

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

Overview

Channel usage data for a specific channel

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(channel = SKIP, noise = SKIP, non_wifi = SKIP, wifi = SKIP) ⇒ ResponsePastSpectrumAnalysisChannelUsage

Returns a new instance of ResponsePastSpectrumAnalysisChannelUsage.



53
54
55
56
57
58
# File 'lib/mist_api/models/response_past_spectrum_analysis_channel_usage.rb', line 53

def initialize(channel = SKIP, noise = SKIP, non_wifi = SKIP, wifi = SKIP)
  @channel = channel unless channel == SKIP
  @noise = noise unless noise == SKIP
  @non_wifi = non_wifi unless non_wifi == SKIP
  @wifi = wifi unless wifi == SKIP
end

Instance Attribute Details

#channelInteger

Channel number

Returns:

  • (Integer)


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

def channel
  @channel
end

#noiseFloat

Noise level in dBm

Returns:

  • (Float)


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

def noise
  @noise
end

#non_wifiFloat

Percentage of channel usage by non-WiFi signals in the range [0, 1]

Returns:

  • (Float)


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

def non_wifi
  @non_wifi
end

#wifiFloat

Percentage of channel usage by WiFi in the range [0, 1]

Returns:

  • (Float)


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

def wifi
  @wifi
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/mist_api/models/response_past_spectrum_analysis_channel_usage.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  channel = hash.key?('channel') ? hash['channel'] : SKIP
  noise = hash.key?('noise') ? hash['noise'] : SKIP
  non_wifi = hash.key?('non_wifi') ? hash['non_wifi'] : SKIP
  wifi = hash.key?('wifi') ? hash['wifi'] : SKIP

  # Create object from extracted values.
  ResponsePastSpectrumAnalysisChannelUsage.new(channel,
                                               noise,
                                               non_wifi,
                                               wifi)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/mist_api/models/response_past_spectrum_analysis_channel_usage.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['channel'] = 'channel'
  @_hash['noise'] = 'noise'
  @_hash['non_wifi'] = 'non_wifi'
  @_hash['wifi'] = 'wifi'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/mist_api/models/response_past_spectrum_analysis_channel_usage.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    channel
    noise
    non_wifi
    wifi
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
# File 'lib/mist_api/models/response_past_spectrum_analysis_channel_usage.rb', line 85

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} channel: #{@channel.inspect}, noise: #{@noise.inspect}, non_wifi:"\
  " #{@non_wifi.inspect}, wifi: #{@wifi.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



78
79
80
81
82
# File 'lib/mist_api/models/response_past_spectrum_analysis_channel_usage.rb', line 78

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} channel: #{@channel}, noise: #{@noise}, non_wifi: #{@non_wifi}, wifi:"\
  " #{@wifi}>"
end