Class: EdmTrain::Locations

Inherits:
Object
  • Object
show all
Defined in:
lib/edm_train/locations.rb

Overview

Locations API Calls

Class Method Summary collapse

Class Method Details

.allArray<Location>

Returns all known locations

Returns:



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

Examples:

EdmTrain::Locations.find(city: 'Detroit', state: 'Michigan')

Parameters:

  • params (Hash) (defaults to: {})

Options Hash (params):

  • :city (String)

    the city

  • :state (String)

    the state

Returns:



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