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.



16247
16248
16249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16247

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16245
16246
16247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16245

def value
  @value
end

Class Method Details

.ALLObject



16267
16268
16269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16267

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



16252
16253
16254
16255
16256
16257
16258
16259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16252

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



16262
16263
16264
16265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16262

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)



16273
16274
16275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16273

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)



16279
16280
16281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16279

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

Instance Method Details

#to_hashObject



16283
16284
16285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16283

def to_hash
  value
end