Class: Io::Flow::V0::Models::Tracking
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Tracking
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Top level tracking information which contains labels. In cases where shipments are re-labeled, you will see multiple labels for each tracking allowing simple access to see where a shipment is - with which carrier and with the local tracking number
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Tracking
constructor
A new instance of Tracking.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Tracking
Returns a new instance of Tracking.
14601 14602 14603 14604 14605 14606 14607 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14601 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :status, :metadata], 'Tracking') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::TrackingStatus) ? x : ::Io::Flow::V0::Models::TrackingStatus.apply(x)) = HttpClient::Preconditions.assert_class('metadata', HttpClient::Helper.to_object(opts.delete(:metadata)), Hash) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
14599 14600 14601 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14599 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
14599 14600 14601 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14599 def end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
14599 14600 14601 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14599 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14613 14614 14615 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14613 def copy(incoming={}) Tracking.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14617 14618 14619 14620 14621 14622 14623 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14617 def to_hash { :id => id, :status => status.value, :metadata => } end |
#to_json ⇒ Object
14609 14610 14611 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14609 def to_json JSON.dump(to_hash) end |