Class: Translink::Model::Stop

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/translink/model/stop.rb

Class Method Summary collapse

Class Method Details

.find_or_add_from_stop_page(stop_page) ⇒ Model::Stop

Stop model for the given stop_page. Will create the route if it doesn’t exist.

Parameters:

  • route_pate (Page::Route)

    HTML page representing the stop.

Returns:



20
21
22
23
24
25
# File 'lib/translink/model/stop.rb', line 20

def self.find_or_add_from_stop_page stop_page
  first_or_create :id        => stop_page.stop_id,
                  :stop_name => stop_page.stop_name,
                  :stop_lat  => stop_page.stop_lat,
                  :stop_lon  => stop_page.stop_lon
end