Module: RZoopla::Client

Defined in:
lib/zoopla/client.rb,
lib/rzoopla/client.rb

Constant Summary collapse

BASE_URI =
'http://api.zoopla.co.uk/api/v1/'

Class Method Summary collapse

Class Method Details

.get(end_point, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/zoopla/client.rb', line 6

def get(end_point, options = {})
  options = { api_key: RZoopla.configuration.api_key }.merge(options)
  uri = URI.parse([BASE_URI, end_point, '.json', parse_params(options)].join)
  response = Net::HTTP.get_response(uri)
  if response.code == '200'
    JSON.parse(response.body)
  else
    fail "#{response.message} (#{response.code})"
  end
end