Class: Io::Flow::V0::Models::OrderNumberGeneratorPrefixSuffix

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

Overview

Generator with an optional prefix, followed by an integer and an optional suffix

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

Returns a new instance of OrderNumberGeneratorPrefixSuffix.



41403
41404
41405
41406
41407
41408
41409
41410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41403

def initialize(incoming={})
  super(:discriminator => OrderNumberGenerator::Types::ORDER_NUMBER_GENERATOR_PREFIX_SUFFIX)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @prefix = (x = opts.delete(:prefix); x.nil? ? nil : HttpClient::Preconditions.assert_class('prefix', x, String))
  @starts_with = (x = opts.delete(:starts_with); x.nil? ? nil : HttpClient::Preconditions.assert_class('starts_with', x, Integer))
  @suffix = (x = opts.delete(:suffix); x.nil? ? nil : HttpClient::Preconditions.assert_class('suffix', x, String))
  @fixed_length = (x = opts.delete(:fixed_length); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderNumberGeneratorFixedLength) ? x : ::Io::Flow::V0::Models::OrderNumberGeneratorFixedLength.new(x)))
end

Instance Attribute Details

#fixed_lengthObject (readonly)

Returns the value of attribute fixed_length.



41401
41402
41403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41401

def fixed_length
  @fixed_length
end

#prefixObject (readonly)

Returns the value of attribute prefix.



41401
41402
41403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41401

def prefix
  @prefix
end

#starts_withObject (readonly)

Returns the value of attribute starts_with.



41401
41402
41403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41401

def starts_with
  @starts_with
end

#suffixObject (readonly)

Returns the value of attribute suffix.



41401
41402
41403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41401

def suffix
  @suffix
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41416
41417
41418
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41416

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

#subtype_to_hashObject



41420
41421
41422
41423
41424
41425
41426
41427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41420

def subtype_to_hash
  {
    :prefix => prefix,
    :starts_with => starts_with,
    :suffix => suffix,
    :fixed_length => fixed_length.nil? ? nil : fixed_length.to_hash
  }
end

#to_jsonObject



41412
41413
41414
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41412

def to_json
  JSON.dump(to_hash)
end