Class: Io::Flow::V0::Models::OrderNumberGeneratorUuid

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

Overview

Generates an order number based on a UUID (no dashes or other formatting). This is the default for Flow orders (with order number prefixed by ord-)

Instance Attribute Summary collapse

Attributes inherited from OrderNumberGenerator

#discriminator

Instance Method Summary collapse

Methods inherited from OrderNumberGenerator

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OrderNumberGeneratorUuid

Returns a new instance of OrderNumberGeneratorUuid.



39459
39460
39461
39462
39463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39459

def initialize(incoming={})
  super(:discriminator => OrderNumberGenerator::Types::ORDER_NUMBER_GENERATOR_UUID)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @prefix = HttpClient::Preconditions.assert_class('prefix', (x = opts.delete(:prefix); x.nil? ? "ord-" : x), String)
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



39457
39458
39459
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39457

def prefix
  @prefix
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39469
39470
39471
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39469

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

#subtype_to_hashObject



39473
39474
39475
39476
39477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39473

def subtype_to_hash
  {
    :prefix => prefix
  }
end

#to_jsonObject



39465
39466
39467
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39465

def to_json
  JSON.dump(to_hash)
end