Class: Io::Flow::V0::Models::FulfillmentCancellationForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::FulfillmentCancellationForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Changing an order for the purpose of cancelling specific line quantities
Instance Attribute Summary collapse
-
#change_source ⇒ Object
readonly
Returns the value of attribute change_source.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ FulfillmentCancellationForm
constructor
A new instance of FulfillmentCancellationForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ FulfillmentCancellationForm
33421 33422 33423 33424 33425 33426 33427 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33421 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:reason, :lines], 'FulfillmentCancellationForm') @change_source = (x = (x = opts.delete(:change_source); x.nil? ? "fulfillment" : x); x.is_a?(::Io::Flow::V0::Models::OrderChangeSource) ? x : ::Io::Flow::V0::Models::OrderChangeSource.apply(x)) @reason = (x = opts.delete(:reason); x.is_a?(::Io::Flow::V0::Models::CancelReason) ? x : ::Io::Flow::V0::Models::CancelReason.apply(x)) @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FulfillmentLineCancelForm) ? x : ::Io::Flow::V0::Models::FulfillmentLineCancelForm.new(x)) } end |
Instance Attribute Details
#change_source ⇒ Object (readonly)
Returns the value of attribute change_source.
33419 33420 33421 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33419 def change_source @change_source end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
33419 33420 33421 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33419 def lines @lines end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
33419 33420 33421 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33419 def reason @reason end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33433 33434 33435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33433 def copy(incoming={}) FulfillmentCancellationForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33437 33438 33439 33440 33441 33442 33443 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33437 def to_hash { :change_source => change_source.value, :reason => reason.value, :lines => lines.map { |o| o.to_hash } } end |
#to_json ⇒ Object
33429 33430 33431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33429 def to_json JSON.dump(to_hash) end |