Class: Io::Flow::V0::Models::OrderNumberGeneratorHexadecimal

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

Overview

Hexadecimal generator generates a random string, starting with a letter, of a given length

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 = {}) ⇒ OrderNumberGeneratorHexadecimal

Returns a new instance of OrderNumberGeneratorHexadecimal.



48593
48594
48595
48596
48597
48598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48593

def initialize(incoming={})
  super(:discriminator => OrderNumberGenerator::Types::ORDER_NUMBER_GENERATOR_HEXADECIMAL)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:length], 'OrderNumberGeneratorHexadecimal')
  @length = HttpClient::Preconditions.assert_class('length', opts.delete(:length), Integer)
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



48591
48592
48593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48591

def length
  @length
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48604
48605
48606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48604

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

#subtype_to_hashObject



48608
48609
48610
48611
48612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48608

def subtype_to_hash
  {
    :length => length
  }
end

#to_jsonObject



48600
48601
48602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48600

def to_json
  JSON.dump(to_hash)
end