Module: WifiGeoLocation

Defined in:
lib/wifi_geo_location.rb,
lib/wifi_geo_location/client.rb,
lib/wifi_geo_location/version.rb,
lib/wifi_geo_location/wifi_tower.rb

Defined Under Namespace

Classes: Client, WifiTower

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.find(key: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/wifi_geo_location.rb', line 9

def self.find(key: nil)
  client = WifiGeoLocation::Client.new(key: key)

  wifi_towers = WifiGeoLocation::WifiTower.scan

  request_params = {
    wifiAccessPoints: wifi_towers.map do |tower|
      {
        macAddress: tower[:mac_address],
        signalStrength: tower[:signal_strength],
        channel: tower[:channel]
      }
    end
  }

  response = client.post(request_params)
end