lib/ratis/next_bus.rb in ratis-3.1.1 vs lib/ratis/next_bus.rb in ratis-3.1.2
- old
+ new
@@ -1,13 +1,14 @@
module Ratis
class NextBus
- attr_accessor :runs, :status, :sign, :routetype, :times, :direction
+ attr_accessor :runs, :status, :sign, :routetype, :times, :direction, :stop
- def initialize(service, _runs = [])
+ def initialize(service, _runs = [], _stop = {})
@runs = _runs
+ @stop = _stop
@status = service[:status]
@sign = service[:sign]
@routetype = service[:routetype]
@times = service[:times]
@@ -34,12 +35,14 @@
'Date' => datetime.strftime("%m/%d/%Y"),
'Time' => datetime.strftime("%I%M"),
'Type' => type }
return [] unless response.success?
- service = response.body[:nextbus_response][:atstop][:service]
- runs = response.to_array :nextbus_response, :atstop, :service, :tripinfo
- NextBus.new service, runs
+ stop = response.body[:nextbus_response][:atstop]
+ service = stop.delete(:service)
+ runs = service.delete(:tripinfo)
+
+ NextBus.new service, runs, stop
end
# Gets description of first stop
# @return [String] Description of first stop or nil.