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)
-
- (Object) delivery_at
Returns the value of attribute delivery_at.
-
- (Object) destination_city
Returns the value of attribute destination_city.
-
- (Object) destination_country
Returns the value of attribute destination_country.
-
- (Object) destination_residential
Returns the value of attribute destination_residential.
-
- (Object) destination_state
Returns the value of attribute destination_state.
-
- (Object) events
Returns the value of attribute events.
-
- (Object) origin_city
Returns the value of attribute origin_city.
-
- (Object) origin_country
Returns the value of attribute origin_country.
-
- (Object) origin_residential
Returns the value of attribute origin_residential.
-
- (Object) origin_state
Returns the value of attribute origin_state.
-
- (Object) service_type
Returns the value of attribute service_type.
-
- (Object) signature_name
Returns the value of attribute signature_name.
-
- (Object) status
Returns the value of attribute status.
Instance Method Summary (collapse)
- - (Boolean) destination_residential?
-
- (Details) initialize(response)
constructor
A new instance of Details.
- - (Boolean) origin_residential?
Constructor Details
- (Details) initialize(response)
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
- (Object) delivery_at
Returns the value of attribute delivery_at
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def delivery_at @delivery_at end |
- (Object) destination_city
Returns the value of attribute destination_city
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_city @destination_city end |
- (Object) destination_country
Returns the value of attribute destination_country
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_country @destination_country end |
- (Object) destination_residential
Returns the value of attribute destination_residential
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_residential @destination_residential end |
- (Object) destination_state
Returns the value of attribute destination_state
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def destination_state @destination_state end |
- (Object) events
Returns the value of attribute events
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def events @events end |
- (Object) origin_city
Returns the value of attribute origin_city
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_city @origin_city end |
- (Object) origin_country
Returns the value of attribute origin_country
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_country @origin_country end |
- (Object) origin_residential
Returns the value of attribute origin_residential
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_residential @origin_residential end |
- (Object) origin_state
Returns the value of attribute origin_state
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def origin_state @origin_state end |
- (Object) service_type
Returns the value of attribute service_type
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def service_type @service_type end |
- (Object) signature_name
Returns the value of attribute signature_name
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def signature_name @signature_name end |
- (Object) status
Returns the value of attribute status
41 42 43 |
# File 'lib/shippinglogic/fedex/track.rb', line 41 def status @status end |
Instance Method Details
- (Boolean) destination_residential?
59 60 61 |
# File 'lib/shippinglogic/fedex/track.rb', line 59 def destination_residential? destination_residential == true end |
- (Boolean) origin_residential?
55 56 57 |
# File 'lib/shippinglogic/fedex/track.rb', line 55 def origin_residential? origin_residential == true end |