Sha256: 413745f5956062fe2b0b6d48554ce0b6152a7ed33615d26ecf520d6f3984f84b
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
module Ratis class RouteStops def self.all(conditions) route = conditions.delete(:route) direction = conditions.delete(:direction) raise ArgumentError.new('You must provide a route') unless route raise ArgumentError.new('You must provide a direction') unless direction direction = direction.to_s.upcase order = conditions.delete(:order).to_s.upcase Ratis.all_conditions_used? conditions request_params = {'Route' => route, 'Direction' => direction } request_params.merge! order ? { 'Order' => order } : {} response = Request.get 'Routestops', request_params return [] unless response.success? response.to_hash[:routestops_response][:stops][:stop].map do |s| stop = RouteStops::Stop.new stop.description = s[:description] stop.area = s[:area] stop.atis_stop_id = s[:atisstopid] stop.stop_seq = s[:stopseq] stop.latitude, stop.longitude = s[:point].split(',') stop end end end end
Version data entries
13 entries across 13 versions & 1 rubygems