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.



13488
13489
13490
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13488

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13486
13487
13488
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13486

def value
  @value
end

Class Method Details

.ALLObject



13508
13509
13510
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13508

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



13493
13494
13495
13496
13497
13498
13499
13500
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13493

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



13503
13504
13505
13506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13503

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)



13514
13515
13516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13514

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)



13520
13521
13522
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13520

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

Instance Method Details

#to_hashObject



13524
13525
13526
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13524

def to_hash
  value
end