class GeoStalker::Locator::Base
Constants
- ENDPOINT
Public Class Methods
new(api_key)
click to toggle source
# File lib/geo_stalker/locator/base.rb, line 10 def initialize(api_key) @api_key = api_key end
Public Instance Methods
location()
click to toggle source
# File lib/geo_stalker/locator/base.rb, line 14 def location https.start do request = Net::HTTP::Post.new(uri.request_uri) request.body = params.to_json request["Content-Type"] = "application/json" response = https.request(request) JSON.parse(response.body) end end
Private Instance Methods
https()
click to toggle source
# File lib/geo_stalker/locator/base.rb, line 38 def https @https ||= begin https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true https.verify_mode = OpenSSL::SSL::VERIFY_NONE https end end
params()
click to toggle source
# File lib/geo_stalker/locator/base.rb, line 30 def params { wifiAccessPoints: wifi_access_points } end
uri()
click to toggle source
# File lib/geo_stalker/locator/base.rb, line 34 def uri @uri ||= URI.parse(ENDPOINT + @api_key) end
wifi_access_points()
click to toggle source
# File lib/geo_stalker/locator/base.rb, line 26 def wifi_access_points fail NotImplementedError, "You must implement #{self.class}##{__method__}" end