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.



11121
11122
11123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11121

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11119
11120
11121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11119

def value
  @value
end

Class Method Details

.ALLObject



11141
11142
11143
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11141

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



11126
11127
11128
11129
11130
11131
11132
11133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11126

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



11136
11137
11138
11139
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11136

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)



11147
11148
11149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11147

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)



11153
11154
11155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11153

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

Instance Method Details

#to_hashObject



11157
11158
11159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11157

def to_hash
  value
end