Class: BookingLocations::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/booking_locations/api.rb

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
# File 'lib/booking_locations/api.rb', line 12

def all
  response = open("#{api_uri}/api/v1/booking_locations.json", headers_and_options)
  JSON.parse(response.read)
end

#get(id) ⇒ Object



5
6
7
8
9
10
# File 'lib/booking_locations/api.rb', line 5

def get(id)
  response = open("#{api_uri}/api/v1/booking_locations/#{id}.json", headers_and_options)
  yield JSON.parse(response.read)
rescue OpenURI::HTTPError
  nil
end