Sha256: 377a8ce01a5d4c3fbf05a46347a8913aaa8da2f4983f284206c3ab073fc001d3
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
class Trackerific::Parsers::FedEx < Trackerific::Parsers::Base protected def response_error @response_error ||= if highest_severity == 'ERROR' Trackerific::Error.new(notifications[:message]) else false end end def summary nil end def events track_details.map do |detail| Trackerific::Event.new(parse_date(detail), nil, location(detail)) end end private def location(detail) a = detail[:destination_address] "#{a[:city]}, #{a[:state_or_province_code]} #{a[:country_code]}" end def parse_date(detail) detail[:ship_timestamp] end def track_reply @response.hash[:envelope][:body][:track_reply] end def track_details @track_details ||= begin details = track_reply[:completed_track_details][:track_details] details.select do |d| d[:ship_timestamp].present? && d[:destination_address].present? && d[:destination_address][:city].present? && d[:destination_address][:state_or_province_code].present? end end end def highest_severity track_reply[:highest_severity] end def notifications track_reply[:notifications] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trackerific-0.7.5 | lib/trackerific/parsers/fedex.rb |
trackerific-0.7.4 | lib/trackerific/parsers/fedex.rb |
trackerific-0.7.3 | lib/trackerific/parsers/fedex.rb |