Class: GoTransit::Stop

Inherits:
ApiResource show all
Defined in:
lib/go_transit/resources/stop.rb

Defined Under Namespace

Classes: Destination, Facility, Line, NextService, Parking, Place, Station

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiResource

#initialize

Constructor Details

This class inherits a constructor from GoTransit::ApiResource

Instance Attribute Details

#boarding_infoObject

Returns the value of attribute boarding_info.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def boarding_info
  @boarding_info
end

#boarding_info_frObject

Returns the value of attribute boarding_info_fr.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def boarding_info_fr
  @boarding_info_fr
end

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def city
  @city
end

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def code
  @code
end

#driving_directionsObject

Returns the value of attribute driving_directions.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def driving_directions
  @driving_directions
end

#driving_directions_frObject

Returns the value of attribute driving_directions_fr.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def driving_directions_fr
  @driving_directions_fr
end

#facilitiesObject

Returns the value of attribute facilities.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def facilities
  @facilities
end

#intersectionObject

Returns the value of attribute intersection.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def intersection
  @intersection
end

#is_busObject

Returns the value of attribute is_bus.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def is_bus
  @is_bus
end

#is_trainObject

Returns the value of attribute is_train.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def is_train
  @is_train
end

#latitudeObject

Returns the value of attribute latitude.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def latitude
  @latitude
end

#linesObject

Returns the value of attribute lines.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def lines
  @lines
end

#longitudeObject

Returns the value of attribute longitude.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def longitude
  @longitude
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def name
  @name
end

#parkingsObject

Returns the value of attribute parkings.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def parkings
  @parkings
end

#placeObject

Returns the value of attribute place.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def place
  @place
end

#stationsObject

Returns the value of attribute stations.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def stations
  @stations
end

#stop_nameObject

Returns the value of attribute stop_name.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def stop_name
  @stop_name
end

#stop_name_frObject

Returns the value of attribute stop_name_fr.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def stop_name_fr
  @stop_name_fr
end

#street_nameObject

Returns the value of attribute street_name.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def street_name
  @street_name
end

#street_numberObject

Returns the value of attribute street_number.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def street_number
  @street_number
end

#ticket_salesObject

Returns the value of attribute ticket_sales.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def ticket_sales
  @ticket_sales
end

#ticket_sales_frObject

Returns the value of attribute ticket_sales_fr.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def ticket_sales_fr
  @ticket_sales_fr
end

#zone_codeObject

Returns the value of attribute zone_code.



3
4
5
# File 'lib/go_transit/resources/stop.rb', line 3

def zone_code
  @zone_code
end

Class Method Details

.allObject



9
10
11
12
13
# File 'lib/go_transit/resources/stop.rb', line 9

def self.all
  client = Client.new
  response = client.get("Stop/All")
  new(response.data).stations
end

.destinations(stop_code:, from_time:, to_time:) ⇒ Object



27
28
29
30
31
# File 'lib/go_transit/resources/stop.rb', line 27

def self.destinations(stop_code:, from_time:, to_time:)
  client = Client.new
  response = client.get("Stop/Destinations/#{stop_code}/#{from_time}/#{to_time}")
  Stop::Destination.new(response.data)
end

.details(stop_code:) ⇒ Object



15
16
17
18
19
# File 'lib/go_transit/resources/stop.rb', line 15

def self.details(stop_code:)
  client = Client.new
  response = client.get("Stop/Details/#{stop_code}")
  new(response.data)
end

.next_service(stop_code:) ⇒ Object



21
22
23
24
25
# File 'lib/go_transit/resources/stop.rb', line 21

def self.next_service(stop_code:)
  client = Client.new
  response = client.get("Stop/NextService/#{stop_code}")
  Stop::NextService.new(response.data)
end

Instance Method Details

#bus?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/go_transit/resources/stop.rb', line 33

def bus?
  is_bus.to_i.positive?
end

#train?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/go_transit/resources/stop.rb', line 37

def train?
  is_train.to_i.positive?
end