Class: DoubleMap::Client::Stops

Inherits:
API
  • Object
show all
Extended by:
Memoist
Defined in:
lib/doublemap_api/client/stops.rb

Instance Method Summary collapse

Methods inherited from API

#get_request, include_api, #post_request, #refresh, require_all, singleton

Methods included from DoubleMap::Connection

#adapter, #connection, #register_adapter

Instance Method Details

#get(id) ⇒ Object Also known as: find

Return the route whose id matches the given id



13
14
15
# File 'lib/doublemap_api/client/stops.rb', line 13

def get id
  list.find{ |stop| stop.id == id }
end

#listObject Also known as: all

Return a list of all stops on the system.



6
7
8
# File 'lib/doublemap_api/client/stops.rb', line 6

def list
  get_request('/map/v2/stops').map{ |stop| Stop.new(stop) }.each(&on_stop)
end