class Io::Flow::V0::Models::OrderIdentifier

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.

Attributes

id[R]
identifier[R]
name[R]
number[R]
order[R]
primary[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52016
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))
  @name = HttpClient::Preconditions.assert_class('name', (x = opts.delete(:name); x.nil? ? "external" : x), String)
  @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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52031
def copy(incoming={})
  OrderIdentifier.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52035
def to_hash
  {
    :id => id,
    :order => order.to_hash,
    :name => name,
    :identifier => identifier,
    :primary => primary,
    :number => number
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52027
def to_json
  JSON.dump(to_hash)
end