class Io::Flow::V0::Models::FulfillmentCancellationForm

Changing an order for the purpose of cancelling specific line quantities

Attributes

change_source[R]
lines[R]
reason[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 43995
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 44007
def copy(incoming={})
  FulfillmentCancellationForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 44011
def to_hash
  {
    :change_source => change_source.value,
    :reason => reason.value,
    :lines => lines.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 44003
def to_json
  JSON.dump(to_hash)
end