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.



11370
11371
11372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11370

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11368
11369
11370
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11368

def value
  @value
end

Class Method Details

.ALLObject



11390
11391
11392
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11390

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



11375
11376
11377
11378
11379
11380
11381
11382
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11375

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



11385
11386
11387
11388
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11385

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)



11396
11397
11398
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11396

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)



11402
11403
11404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11402

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

Instance Method Details

#to_hashObject



11406
11407
11408
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11406

def to_hash
  value
end