Class: BookingLocations::StubApi

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

Instance Method Summary collapse

Instance Method Details

#allObject



25
26
27
28
29
30
31
32
# File 'lib/booking_locations/stub_api.rb', line 25

def all
  json.map do |location|
    {
      'uid'   => location['uid'],
      'title' => location['name']
    }
  end
end

#get(id) {|json.first| ... } ⇒ Object

Yields:

  • (json.first)


19
20
21
22
23
# File 'lib/booking_locations/stub_api.rb', line 19

def get(id)
  return nil unless KNOWN_LOCATION_IDS.include?(id)

  yield json.first
end