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.



47940
47941
47942
47943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47940

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.



47938
47939
47940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47938

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47949
47950
47951
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47949

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

#to_hashObject



47953
47954
47955
47956
47957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47953

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

#to_jsonObject



47945
47946
47947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47945

def to_json
  JSON.dump(to_hash)
end