Class: Io::Flow::V0::Models::OrderIdentifier

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

Overview

Represents alternate numbers with which to identify an order.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderIdentifier

Returns a new instance of OrderIdentifier.



16886
16887
16888
16889
16890
16891
16892
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16886

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

Instance Attribute Details

#id ⇒ Object (readonly)

Returns the value of attribute id.



16884
16885
16886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16884

def id
  @id
end

#number ⇒ Object (readonly)

Returns the value of attribute number.



16884
16885
16886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16884

def number
  @number
end

#order ⇒ Object (readonly)

Returns the value of attribute order.



16884
16885
16886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16884

def order
  @order
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16898
16899
16900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16898

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

#to_hash ⇒ Object



16902
16903
16904
16905
16906
16907
16908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16902

def to_hash
  {
    :id => id,
    :order => order.to_hash,
    :number => number
  }
end

#to_json ⇒ Object



16894
16895
16896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16894

def to_json
  JSON.dump(to_hash)
end