Class: LocationQuery
Constant Summary collapse
- LOCATION_URL =
'https://devapi.globelabs.com.ph/location/v1/queries/location?access_token=%s&address=%s&requestedAccuracy=%s'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
Instance Method Summary collapse
-
#get_location(address, accuracy = 10) ⇒ Object
Fetches the geolocation of a given address.
-
#initialize(access_token) ⇒ Object
constructor
Starts up whenever the class is being called.
Methods inherited from Base
#send_get_request, #send_post_request
Constructor Details
#initialize(access_token) ⇒ Object
Starts up whenever the class is being called.
11 12 13 |
# File 'lib/globe_connect/location_query.rb', line 11 def initialize(access_token) @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/globe_connect/location_query.rb', line 5 def access_token @access_token end |
Instance Method Details
#get_location(address, accuracy = 10) ⇒ Object
Fetches the geolocation of a given address.
20 21 22 23 24 25 26 27 28 |
# File 'lib/globe_connect/location_query.rb', line 20 def get_location(address, accuracy = 10) # prepare the request url url = sprintf(LOCATION_URL, @access_token, address, accuracy) # set get request response = send_get_request(url) return JSON.parse(response) end |