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.



14423
14424
14425
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14423

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14421
14422
14423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14421

def value
  @value
end

Class Method Details

.ALLObject



14443
14444
14445
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14443

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



14428
14429
14430
14431
14432
14433
14434
14435
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14428

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



14438
14439
14440
14441
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14438

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)



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

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)



14455
14456
14457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14455

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

Instance Method Details

#to_hashObject



14459
14460
14461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14459

def to_hash
  value
end