Class: GoTransit::Fare

Inherits:
ApiResource show all
Includes:
Enumerable
Defined in:
lib/go_transit/resources/fare.rb

Defined Under Namespace

Classes: FareCategory

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

#fare_categoriesObject

Returns the value of attribute fare_categories.



5
6
7
# File 'lib/go_transit/resources/fare.rb', line 5

def fare_categories
  @fare_categories
end

Class Method Details

.get(from_stop_code:, to_stop_code:, operational_day: nil) ⇒ Object



7
8
9
10
11
# File 'lib/go_transit/resources/fare.rb', line 7

def self.get(from_stop_code:, to_stop_code:, operational_day: nil)
  client = Client.new
  response = client.get("Fares/#{from_stop_code}/#{to_stop_code}/#{operational_day}")
  new(response.data)
end

Instance Method Details

#each(&block) ⇒ Object



13
14
15
# File 'lib/go_transit/resources/fare.rb', line 13

def each(&block)
  fare_categories.each(&block)
end