Class: Io::Flow::V0::Models::OrderReplacementForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

The order replacement form is used to create a replacement order.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderReplacementForm

Returns a new instance of OrderReplacementForm.



53913
53914
53915
53916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53913

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @items = (x = opts.delete(:items); x.nil? ? nil : HttpClient::Preconditions.assert_class('items', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) })
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



53911
53912
53913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53911

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53922
53923
53924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53922

def copy(incoming={})
  OrderReplacementForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



53926
53927
53928
53929
53930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53926

def to_hash
  {
    :items => items.nil? ? nil : items.map { |o| o.to_hash }
  }
end

#to_jsonObject



53918
53919
53920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53918

def to_json
  JSON.dump(to_hash)
end