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, = {}) = { api_key: RZoopla.configuration.api_key }.merge() uri = URI.parse([BASE_URI, end_point, '.json', parse_params()].join) response = Net::HTTP.get_response(uri) if response.code == '200' JSON.parse(response.body) else fail "#{response.} (#{response.code})" end end |