Class: GoogleMapsPlatform::WiFiAccessPoint

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/google_maps_platform/models/wi_fi_access_point.rb

Overview

Attributes used to describe a WiFi access point.

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(mac_address:, signal_strength: SKIP, signal_to_noise_ratio: SKIP, age: SKIP, channel: SKIP, additional_properties: nil) ⇒ WiFiAccessPoint

Returns a new instance of WiFiAccessPoint.



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

def initialize(mac_address:, signal_strength: SKIP,
               signal_to_noise_ratio: SKIP, age: SKIP, channel: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @mac_address = mac_address
  @signal_strength = signal_strength unless signal_strength == SKIP
  @signal_to_noise_ratio = signal_to_noise_ratio unless signal_to_noise_ratio == SKIP
  @age = age unless age == SKIP
  @channel = channel unless channel == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#ageInteger

The number of milliseconds since this access point was detected.

Returns:

  • (Integer)


27
28
29
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 27

def age
  @age
end

#channelInteger

The channel over which the client is communication with the access point.

Returns:

  • (Integer)


31
32
33
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 31

def channel
  @channel
end

#mac_addressString

The MAC address of the WiFi node. It’s typically called a BSS, BSSID or MAC address. Separators must be : (colon).

Returns:

  • (String)


15
16
17
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 15

def mac_address
  @mac_address
end

#signal_strengthInteger

The current signal strength measured in dBm.

Returns:

  • (Integer)


19
20
21
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 19

def signal_strength
  @signal_strength
end

#signal_to_noise_ratioInteger

The current signal to noise ratio measured in dB.

Returns:

  • (Integer)


23
24
25
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 23

def signal_to_noise_ratio
  @signal_to_noise_ratio
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
99
100
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  mac_address = hash.key?('macAddress') ? hash['macAddress'] : nil
  signal_strength =
    hash.key?('signalStrength') ? hash['signalStrength'] : SKIP
  signal_to_noise_ratio =
    hash.key?('signalToNoiseRatio') ? hash['signalToNoiseRatio'] : SKIP
  age = hash.key?('age') ? hash['age'] : SKIP
  channel = hash.key?('channel') ? hash['channel'] : SKIP

  # 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.

  WiFiAccessPoint.new(mac_address: mac_address,
                      signal_strength: signal_strength,
                      signal_to_noise_ratio: signal_to_noise_ratio,
                      age: age,
                      channel: channel,
                      additional_properties: 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/google_maps_platform/models/wi_fi_access_point.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mac_address'] = 'macAddress'
  @_hash['signal_strength'] = 'signalStrength'
  @_hash['signal_to_noise_ratio'] = 'signalToNoiseRatio'
  @_hash['age'] = 'age'
  @_hash['channel'] = 'channel'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    signal_strength
    signal_to_noise_ratio
    age
    channel
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
117
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mac_address: #{@mac_address.inspect}, signal_strength:"\
  " #{@signal_strength.inspect}, signal_to_noise_ratio: #{@signal_to_noise_ratio.inspect},"\
  " age: #{@age.inspect}, channel: #{@channel.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
108
# File 'lib/google_maps_platform/models/wi_fi_access_point.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mac_address: #{@mac_address}, signal_strength: #{@signal_strength},"\
  " signal_to_noise_ratio: #{@signal_to_noise_ratio}, age: #{@age}, channel: #{@channel},"\
  " additional_properties: #{@additional_properties}>"
end