module Pointpin

Constants

VERSION

Public Class Methods

connection() click to toggle source
# File lib/pointpin.rb, line 24
def connection
  @connection ||= Faraday.new
end
connection=(connection) click to toggle source
# File lib/pointpin.rb, line 28
def connection=(connection)
  @connection = connection
end
locate(ip) click to toggle source
# File lib/pointpin.rb, line 14
def locate(ip)
  pointpin_url = "#{ Pointpin.api_endpoint }/#{ Pointpin.api_key }/json/#{ ip }"

  pointpin_response = get(pointpin_url)

  if pointpin_response.success?
    return Hashie::Mash.new(MultiJson.load(pointpin_response.body))
  end
end

Private Class Methods

get(path, params = {}) click to toggle source
# File lib/pointpin.rb, line 34
def get(path, params = {})
  params = Pointpin.default_params.merge(params || {})

  connection.get(path, params)
end