class Opennorth::Represent::Real

Attributes

connection[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/opennorth/represent.rb, line 18
def initialize(options={})
  @connection = Fog::Connection.new(BASE_URL,false,connection_options)
end

Public Instance Methods

get_postal_code(postal_code) click to toggle source
# File lib/opennorth/represent/requests/get_postal_code.rb, line 6
def get_postal_code(postal_code)
  response = request(path: postal_code_path(postal_code),
         method: :get)

  response.body = JSON::parse(response.body)
  response
end
request(options={}) click to toggle source
# File lib/opennorth/represent.rb, line 22
def request(options={})
  connection.request(options)
end

Private Instance Methods

connection_options() click to toggle source
# File lib/opennorth/represent.rb, line 29
def connection_options
  options = {}
  options.merge!(proxy: ENV["FOG_PROXY"]) if ENV["FOG_PROXY"]
  options
end
postal_code_path(postal_code) click to toggle source
# File lib/opennorth/represent/requests/get_postal_code.rb, line 15
def postal_code_path(postal_code)
  POSTAL_CODES_PATH + "/" + postal_code + "/"
end