Class: Io::Flow::V0::Models::CurrencySymbolFormat

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) ⇒ CurrencySymbolFormat

Returns a new instance of CurrencySymbolFormat.



8902
8903
8904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8902

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8900
8901
8902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8900

def value
  @value
end

Class Method Details

.ALLObject



8922
8923
8924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8922

def CurrencySymbolFormat.ALL
  @@all ||= [CurrencySymbolFormat.narrow, CurrencySymbolFormat.primary]
end

.apply(value) ⇒ Object

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



8907
8908
8909
8910
8911
8912
8913
8914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8907

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

.from_string(value) ⇒ Object

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



8917
8918
8919
8920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8917

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

.narrowObject

The narrow format refers to the Unicode Common Locale Data Repository (CLDR) ‘narrow’ symbols (e.g. ‘$’ for CAD and AUD)



8928
8929
8930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8928

def CurrencySymbolFormat.narrow
  @@_narrow ||= CurrencySymbolFormat.new('narrow')
end

.primaryObject

The primary format refers to the Unicode Common Locale Data Repository (CLDR) ‘primary’ symbols (e.g. ‘CA$’ for CAD and ‘A$’ for AUD)



8934
8935
8936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8934

def CurrencySymbolFormat.primary
  @@_primary ||= CurrencySymbolFormat.new('primary')
end

Instance Method Details

#to_hashObject



8938
8939
8940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8938

def to_hash
  value
end