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.
59211 59212 59213 59214 59215 59216 59217 59218 59219 59220 59221 59222 59223 59224 59225 59226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59211 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.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def carrier_tracking_number @carrier_tracking_number end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def destination @destination end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def key @key end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def labels @labels end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def order @order end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def origin @origin end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def service @service end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def source @source end |
#tracking_status ⇒ Object (readonly)
Returns the value of attribute tracking_status.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def tracking_status @tracking_status end |
#tracking_status_timestamp ⇒ Object (readonly)
Returns the value of attribute tracking_status_timestamp.
59209 59210 59211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59209 def @tracking_status_timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
59232 59233 59234 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59232 def copy(incoming={}) Return.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
59236 59237 59238 59239 59240 59241 59242 59243 59244 59245 59246 59247 59248 59249 59250 59251 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59236 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
59228 59229 59230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59228 def to_json JSON.dump(to_hash) end |