Class: TripSpark::Client::Patterns
- Extended by:
- Memoist
- Defined in:
- lib/tripspark_api/client/patterns.rb
Instance Method Summary collapse
-
#get(key) ⇒ Object
(also: #find)
Return the route whose key matches the given key.
-
#list(route_key) ⇒ Object
(also: #all)
Return a list of all patterns belonging to the given route.
Methods inherited from API
#get_request, include_api, #post_request, #refresh, require_all, singleton
Methods included from TripSpark::Connection
#adapter, #connection, #register_adapter
Instance Method Details
#get(key) ⇒ Object Also known as: find
Return the route whose key matches the given key
19 20 21 |
# File 'lib/tripspark_api/client/patterns.rb', line 19 def get key list.find{ |pattern| pattern.key == key } end |
#list(route_key) ⇒ Object Also known as: all
Return a list of all patterns belonging to the given route. Currently, there is no direct way to retrieve all patterns for all routes.
7 8 9 10 11 12 13 14 |
# File 'lib/tripspark_api/client/patterns.rb', line 7 def list route_key params = { body: { routeKey: route_key } } post_request('/RouteMap/GetPatternPoints/', params).map{ |pattern| Pattern.new(pattern) } end |