Class: Io::Flow::V0::Models::OrderIdentifier
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderIdentifier
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents alternate identifiers that can be used to lookup an order. Common use cases are to support attaching a primary identifier (e.g. a nice order number) post order submission or attaching IDs that are used by the warehouse to ship the orders.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#primary ⇒ Object
readonly
Returns the value of attribute primary.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderIdentifier
constructor
A new instance of OrderIdentifier.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderIdentifier
Returns a new instance of OrderIdentifier.
35881 35882 35883 35884 35885 35886 35887 35888 35889 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35881 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :order, :identifier, :primary], '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)) @identifier = HttpClient::Preconditions.assert_class('identifier', opts.delete(:identifier), String) @primary = HttpClient::Preconditions.assert_boolean('primary', opts.delete(:primary)) @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String)) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
35879 35880 35881 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35879 def id @id end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
35879 35880 35881 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35879 def identifier @identifier end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
35879 35880 35881 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35879 def number @number end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
35879 35880 35881 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35879 def order @order end |
#primary ⇒ Object (readonly)
Returns the value of attribute primary.
35879 35880 35881 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35879 def primary @primary end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35895 35896 35897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35895 def copy(incoming={}) OrderIdentifier.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35899 35900 35901 35902 35903 35904 35905 35906 35907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35899 def to_hash { :id => id, :order => order.to_hash, :identifier => identifier, :primary => primary, :number => number } end |
#to_json ⇒ Object
35891 35892 35893 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35891 def to_json JSON.dump(to_hash) end |