Class: Salesfly::GeoLocationAPI
- Inherits:
-
Object
- Object
- Salesfly::GeoLocationAPI
- Defined in:
- lib/salesfly/geoip_api.rb
Instance Method Summary collapse
- #get(ip, options = {}) ⇒ Object
- #get_bulk(ip_list, options = {}) ⇒ Object
- #get_current(options = {}) ⇒ Object
-
#initialize(rest_client) ⇒ GeoLocationAPI
constructor
A new instance of GeoLocationAPI.
Constructor Details
#initialize(rest_client) ⇒ GeoLocationAPI
Returns a new instance of GeoLocationAPI.
4 5 6 |
# File 'lib/salesfly/geoip_api.rb', line 4 def initialize(rest_client) @rest_client = rest_client end |
Instance Method Details
#get(ip, options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/salesfly/geoip_api.rb', line 8 def get(ip, ={}) query = URI.encode_www_form() return @rest_client.get("/v1/geoip/#{ip}?#{query}") end |
#get_bulk(ip_list, options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/salesfly/geoip_api.rb', line 17 def get_bulk(ip_list, ={}) ip = ip_list.join(",") return self.get(ip, ) end |
#get_current(options = {}) ⇒ Object
13 14 15 |
# File 'lib/salesfly/geoip_api.rb', line 13 def get_current(={}) return self.get("myip", ) end |