Class: Bart::Client::Routes

Inherits:
API
  • Object
show all
Extended by:
Memoist
Defined in:
lib/bart_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 Bart::Connection

#adapter, #connection, #register_adapter

Instance Method Details

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

Return the route whose id matches the given id



14
15
16
17
# File 'lib/bart_api/client/routes.rb', line 14

def get id
  parsed = get_request '/api/route.aspx', query: { cmd: :routeinfo, route: id }
  Route.new parsed['root']['routes']['route']
end

#listObject Also known as: all

Return a list of all routes on the system.



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

def list
  parsed = get_request '/api/route.aspx', query: { cmd: :routes }
  parsed['root']['routes']['route'].map { |route| Route.new route }
end