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.
63902 63903 63904 63905 63906 63907 63908 63909 63910 63911 63912 63913 63914 63915 63916 63917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63902 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.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def carrier_tracking_number @carrier_tracking_number end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def destination @destination end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def key @key end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def labels @labels end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def order @order end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def origin @origin end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def service @service end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def source @source end |
#tracking_status ⇒ Object (readonly)
Returns the value of attribute tracking_status.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def tracking_status @tracking_status end |
#tracking_status_timestamp ⇒ Object (readonly)
Returns the value of attribute tracking_status_timestamp.
63900 63901 63902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63900 def @tracking_status_timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
63923 63924 63925 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63923 def copy(incoming={}) Return.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
63927 63928 63929 63930 63931 63932 63933 63934 63935 63936 63937 63938 63939 63940 63941 63942 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63927 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
63919 63920 63921 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63919 def to_json JSON.dump(to_hash) end |