class BookingLocations::StubApi
Public Instance Methods
all()
click to toggle source
# 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) { |first| ... }
click to toggle source
# File lib/booking_locations/stub_api.rb, line 19 def get(id) return nil unless KNOWN_LOCATION_IDS.include?(id) yield json.first end
Private Instance Methods
json()
click to toggle source
# File lib/booking_locations/stub_api.rb, line 36 def json @json ||= begin contents = IO.read(File.join(File.dirname(File.expand_path(__FILE__)), 'stub_api.json')) JSON.parse(contents) end end