Class: EdmTrain::Locations
- Inherits:
-
Object
- Object
- EdmTrain::Locations
- Defined in:
- lib/edm_train/locations.rb
Overview
Locations API Calls
Class Method Summary collapse
-
.all ⇒ Array<Location>
Returns all known locations.
-
.find(params = {}) ⇒ Location
Returns a location based on city and state.
Class Method Details
.all ⇒ Array<Location>
Returns all known locations
8 9 10 11 12 |
# File 'lib/edm_train/locations.rb', line 8 def self.all EdmTrain.client.get('/locations').map do |raw_location| Location.new(raw_location) end end |
.find(params = {}) ⇒ Location
Returns a location based on city and state
21 22 23 |
# File 'lib/edm_train/locations.rb', line 21 def self.find(params = {}) Location.new(EdmTrain.client.get('/locations', city: params[:city], state: params[:state]).first) end |