Class: Shippinglogic::FedEx::Track::Details
- Inherits:
-
Object
- Object
- Shippinglogic::FedEx::Track::Details
- Defined in:
- lib/shippinglogic/fedex/track.rb
Defined Under Namespace
Classes: Event
Instance Attribute Summary collapse
-
#delivery_at ⇒ Object
Returns the value of attribute delivery_at.
-
#destination_city ⇒ Object
Returns the value of attribute destination_city.
-
#destination_country ⇒ Object
Returns the value of attribute destination_country.
-
#destination_residential ⇒ Object
Returns the value of attribute destination_residential.
-
#destination_state ⇒ Object
Returns the value of attribute destination_state.
-
#events ⇒ Object
Returns the value of attribute events.
-
#origin_city ⇒ Object
Returns the value of attribute origin_city.
-
#origin_country ⇒ Object
Returns the value of attribute origin_country.
-
#origin_residential ⇒ Object
Returns the value of attribute origin_residential.
-
#origin_state ⇒ Object
Returns the value of attribute origin_state.
-
#service_type ⇒ Object
Returns the value of attribute service_type.
-
#signature_name ⇒ Object
Returns the value of attribute signature_name.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #destination_residential? ⇒ Boolean
-
#initialize(response) ⇒ Details
constructor
A new instance of Details.
- #origin_residential? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Details
Returns a new instance of Details.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/shippinglogic/fedex/track.rb', line 63 def initialize(response) details = response[:track_details] self.origin_city = details[:origin_location_address][:city] self.origin_state = details[:origin_location_address][:state_or_province_code] self.origin_country = details[:origin_location_address][:country_code] self.origin_residential = details[:origin_location_address][:residential] == "true" self.destination_city = details[:destination_address][:city] self.destination_state = details[:destination_address][:state_or_province_code] self.destination_country = details[:destination_address][:country_code] self.destination_residential = details[:destination_address][:residential] == "true" self.signature_name = details[:delivery_signature_name] self.service_type = details[:service_type] self.status = details[:status_description] self.delivery_at = Time.parse(details[:actual_delivery_timestamp]) self.events = response[:track_details][:events].collect do |details| event = Event.new event.name = details[:event_description] event.type = details[:event_type] event.occured_at = Time.parse(details[:timestamp]) event.city = details[:address][:city] event.state = details[:address][:state_or_province_code] event.postal_code = details[:address][:postal_code] event.country = details[:address][:country_code] event.residential = details[:address][:residential] == "true" event end end |
Instance Attribute Details
#delivery_at ⇒ Object
Returns the value of attribute delivery_at.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def delivery_at @delivery_at end |
#destination_city ⇒ Object
Returns the value of attribute destination_city.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_city @destination_city end |
#destination_country ⇒ Object
Returns the value of attribute destination_country.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_country @destination_country end |
#destination_residential ⇒ Object
Returns the value of attribute destination_residential.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_residential @destination_residential end |
#destination_state ⇒ Object
Returns the value of attribute destination_state.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_state @destination_state end |
#events ⇒ Object
Returns the value of attribute events.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def events @events end |
#origin_city ⇒ Object
Returns the value of attribute origin_city.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_city @origin_city end |
#origin_country ⇒ Object
Returns the value of attribute origin_country.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_country @origin_country end |
#origin_residential ⇒ Object
Returns the value of attribute origin_residential.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_residential @origin_residential end |
#origin_state ⇒ Object
Returns the value of attribute origin_state.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_state @origin_state end |
#service_type ⇒ Object
Returns the value of attribute service_type.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def service_type @service_type end |
#signature_name ⇒ Object
Returns the value of attribute signature_name.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def signature_name @signature_name end |
#status ⇒ Object
Returns the value of attribute status.
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def status @status end |
Instance Method Details
#destination_residential? ⇒ Boolean
59 60 61 |
# File 'lib/shippinglogic/fedex/track.rb', line 59 def destination_residential? destination_residential == true end |
#origin_residential? ⇒ Boolean
55 56 57 |
# File 'lib/shippinglogic/fedex/track.rb', line 55 def origin_residential? origin_residential == true end |