Class: Io::Flow::V0::Models::OrderReplacement

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

Overview

The order replacement details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderReplacement

Returns a new instance of OrderReplacement.



53849
53850
53851
53852
53853
53854
53855
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53849

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :parent_order, :replacement_order], 'OrderReplacement')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @parent_order = (x = opts.delete(:parent_order); x.is_a?(::Io::Flow::V0::Models::Order) ? x : ::Io::Flow::V0::Models::Order.new(x))
  @replacement_order = (x = opts.delete(:replacement_order); x.is_a?(::Io::Flow::V0::Models::Order) ? x : ::Io::Flow::V0::Models::Order.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



53847
53848
53849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53847

def id
  @id
end

#parent_orderObject (readonly)

Returns the value of attribute parent_order.



53847
53848
53849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53847

def parent_order
  @parent_order
end

#replacement_orderObject (readonly)

Returns the value of attribute replacement_order.



53847
53848
53849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53847

def replacement_order
  @replacement_order
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53861
53862
53863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53861

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

#to_hashObject



53865
53866
53867
53868
53869
53870
53871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53865

def to_hash
  {
    :id => id,
    :parent_order => parent_order.to_hash,
    :replacement_order => replacement_order.to_hash
  }
end

#to_jsonObject



53857
53858
53859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53857

def to_json
  JSON.dump(to_hash)
end