Class: Io::Flow::V0::Models::AttributeDataType

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ AttributeDataType

Returns a new instance of AttributeDataType.



6574
6575
6576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6574

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6572
6573
6574
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6572

def value
  @value
end

Class Method Details

.ALLObject



6594
6595
6596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6594

def AttributeDataType.ALL
  @@all ||= [AttributeDataType.decimal, AttributeDataType.string]
end

.apply(value) ⇒ Object

Returns the instance of AttributeDataType for this value, creating a new instance for an unknown value



6579
6580
6581
6582
6583
6584
6585
6586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6579

def AttributeDataType.apply(value)
  if value.instance_of?(AttributeDataType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || AttributeDataType.new(value))
  end
end

.decimalObject

Decimal datatype without size or precision restrictions. Commonly used for currency values.



6600
6601
6602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6600

def AttributeDataType.decimal
  @@_decimal ||= AttributeDataType.new('decimal')
end

.from_string(value) ⇒ Object

Returns the instance of AttributeDataType for this value, or nil if not found



6589
6590
6591
6592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6589

def AttributeDataType.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  AttributeDataType.ALL.find { |v| v.value == value }
end

.stringObject

Unvalidated string of characters.



6605
6606
6607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6605

def AttributeDataType.string
  @@_string ||= AttributeDataType.new('string')
end

Instance Method Details

#to_hashObject



6609
6610
6611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6609

def to_hash
  value
end