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.



6623
6624
6625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6623

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6621
6622
6623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6621

def value
  @value
end

Class Method Details

.ALLObject



6643
6644
6645
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6643

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



6628
6629
6630
6631
6632
6633
6634
6635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6628

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.



6649
6650
6651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6649

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



6638
6639
6640
6641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6638

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.



6654
6655
6656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6654

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

Instance Method Details

#to_hashObject



6658
6659
6660
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6658

def to_hash
  value
end