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.



5677
5678
5679
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5677

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5675
5676
5677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5675

def value
  @value
end

Class Method Details

.ALLObject



5697
5698
5699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5697

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



5682
5683
5684
5685
5686
5687
5688
5689
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5682

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.



5703
5704
5705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5703

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



5692
5693
5694
5695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5692

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.



5708
5709
5710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5708

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

Instance Method Details

#to_hashObject



5712
5713
5714
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5712

def to_hash
  value
end