Class: DoubleMap::Client::Routes

Inherits:
API
  • Object
show all
Extended by:
Memoist
Defined in:
lib/doublemap_api/client/routes.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/routes.rb', line 13

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

#listObject Also known as: all

Return a list of all routes on the system.



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

def list
  get_request('/map/v2/routes').map{ |route| Route.new(route) }.each(&on_route)
end