Class: Io::Flow::V0::Models::Return
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Return
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#carrier_tracking_number ⇒ Object
readonly
Returns the value of attribute carrier_tracking_number.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#tracking_status ⇒ Object
readonly
Returns the value of attribute tracking_status.
-
#tracking_status_timestamp ⇒ Object
readonly
Returns the value of attribute tracking_status_timestamp.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Return
constructor
A new instance of Return.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Return
Returns a new instance of Return.
48581 48582 48583 48584 48585 48586 48587 48588 48589 48590 48591 48592 48593 48594 48595 48596 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48581 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :service, :items, :origin, :destination, :source], 'Return') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ReturnOrderReference) ? x : ::Io::Flow::V0::Models::ReturnOrderReference.new(x))) @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x)) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ReturnLineItem) ? x : ::Io::Flow::V0::Models::ReturnLineItem.new(x)) } @labels = (x = opts.delete(:labels); x.nil? ? nil : HttpClient::Preconditions.assert_class('labels', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShippingLabel) ? x : ::Io::Flow::V0::Models::ShippingLabel.new(x)) }) @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @source = (x = opts.delete(:source); x.is_a?(::Io::Flow::V0::Models::ReturnSource) ? x : ::Io::Flow::V0::Models::ReturnSource.from_json(x)) @tracking_status = (x = opts.delete(:tracking_status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ReturnTrackingStatus) ? x : ::Io::Flow::V0::Models::ReturnTrackingStatus.apply(x))) @tracking_status_timestamp = (x = opts.delete(:tracking_status_timestamp); x.nil? ? nil : HttpClient::Preconditions.assert_class('tracking_status_timestamp', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @carrier_tracking_number = (x = opts.delete(:carrier_tracking_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('carrier_tracking_number', x, String)) end |
Instance Attribute Details
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def carrier_tracking_number @carrier_tracking_number end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def destination @destination end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def key @key end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def labels @labels end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def order @order end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def origin @origin end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def service @service end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def source @source end |
#tracking_status ⇒ Object (readonly)
Returns the value of attribute tracking_status.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def tracking_status @tracking_status end |
#tracking_status_timestamp ⇒ Object (readonly)
Returns the value of attribute tracking_status_timestamp.
48579 48580 48581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48579 def @tracking_status_timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
48602 48603 48604 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48602 def copy(incoming={}) Return.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
48606 48607 48608 48609 48610 48611 48612 48613 48614 48615 48616 48617 48618 48619 48620 48621 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48606 def to_hash { :id => id, :key => key, :order => order.nil? ? nil : order.to_hash, :service => service.to_hash, :items => items.map { |o| o.to_hash }, :labels => labels.nil? ? nil : labels.map { |o| o.to_hash }, :origin => origin.to_hash, :destination => destination.to_hash, :source => source.to_hash, :tracking_status => tracking_status.nil? ? nil : tracking_status.value, :tracking_status_timestamp => , :carrier_tracking_number => carrier_tracking_number } end |
#to_json ⇒ Object
48598 48599 48600 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48598 def to_json JSON.dump(to_hash) end |