Class: Salesfly::GeoLocationAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/salesfly/geoip_api.rb

Instance Method Summary collapse

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, options={})
  query = URI.encode_www_form(options)
  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, options={})
  ip = ip_list.join(",")
  return self.get(ip, options)
end

#get_current(options = {}) ⇒ Object



13
14
15
# File 'lib/salesfly/geoip_api.rb', line 13

def get_current(options={})
  return self.get("myip", options)
end