Class: Rome2rio::TransitLeg

Inherits:
Object
  • Object
show all
Defined in:
lib/rome2rio/response/transit_leg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ TransitLeg

Returns a new instance of TransitLeg.



4
5
6
7
8
# File 'lib/rome2rio/response/transit_leg.rb', line 4

def initialize(json)
  @url = json["url"]
  @hops = []
  json["hops"].each { |hop| @hops << TransitHop.new(hop) }
end

Instance Attribute Details

#hopsObject (readonly)

Returns the value of attribute hops.



3
4
5
# File 'lib/rome2rio/response/transit_leg.rb', line 3

def hops
  @hops
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/rome2rio/response/transit_leg.rb', line 3

def url
  @url
end