Class: Io::Flow::V0::Models::TrackingLabelSummary
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TrackingLabelSummary
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#carrier ⇒ Object
readonly
Returns the value of attribute carrier.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tracking ⇒ Object
readonly
Returns the value of attribute tracking.
-
#tracking_number ⇒ Object
readonly
Returns the value of attribute tracking_number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TrackingLabelSummary
constructor
A new instance of TrackingLabelSummary.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TrackingLabelSummary
Returns a new instance of TrackingLabelSummary.
71608 71609 71610 71611 71612 71613 71614 71615 71616 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71608 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :tracking, :status, :carrier, :tracking_number], 'TrackingLabelSummary') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @tracking = (x = opts.delete(:tracking); x.is_a?(::Io::Flow::V0::Models::TrackingSummary) ? x : ::Io::Flow::V0::Models::TrackingSummary.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::TrackingStatus) ? x : ::Io::Flow::V0::Models::TrackingStatus.apply(x)) @carrier = HttpClient::Preconditions.assert_class('carrier', opts.delete(:carrier), String) @tracking_number = HttpClient::Preconditions.assert_class('tracking_number', opts.delete(:tracking_number), String) end |
Instance Attribute Details
#carrier ⇒ Object (readonly)
Returns the value of attribute carrier.
71606 71607 71608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71606 def carrier @carrier end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
71606 71607 71608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71606 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
71606 71607 71608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71606 def status @status end |
#tracking ⇒ Object (readonly)
Returns the value of attribute tracking.
71606 71607 71608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71606 def tracking @tracking end |
#tracking_number ⇒ Object (readonly)
Returns the value of attribute tracking_number.
71606 71607 71608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71606 def tracking_number @tracking_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
71622 71623 71624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71622 def copy(incoming={}) TrackingLabelSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
71626 71627 71628 71629 71630 71631 71632 71633 71634 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71626 def to_hash { :id => id, :tracking => tracking.to_hash, :status => status.value, :carrier => carrier, :tracking_number => tracking_number } end |
#to_json ⇒ Object
71618 71619 71620 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71618 def to_json JSON.dump(to_hash) end |