Sha256: ca6d7430e23cea2f1e932c163315aa714b1f78677eb98042df5e47a9ec391517
Contents?: true
Size: 943 Bytes
Versions: 4
Compression:
Stored size: 943 Bytes
Contents
module Ratis class ItinTrace attr_accessor :success, :legs, :map_extents def initialize(response) @success = response.success? @map_extents = response.body[:itintrace_response][:mapextents].split(',').map(&:to_f).each_slice(2).to_a @legs = response.body.to_array(:itintrace_response, :legs, :leg).map { |l| Hashie::Mash.new l } @legs.each do |leg| leg.distance = leg.distance.to_f leg.points = leg.to_array(:points, :point).collect do |point| point.split(',').map(&:to_f) end leg.stops = leg.to_array(:stops, :stop).collect do |stop| stop.point = stop.point.split(',').map(&:to_f) stop end end end def self.for_tid(tid, trace_info) response = Request.get 'Itintrace', {'Tid' => tid, 'Traceinfo' => trace_info} ItinTrace.new(response) end def success? @success end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ratis-3.6.6 | lib/ratis/itin_trace.rb |
ratis-3.6.5 | lib/ratis/itin_trace.rb |
ratis-3.6.4 | lib/ratis/itin_trace.rb |
ratis-3.6.3 | lib/ratis/itin_trace.rb |