class Io::Flow::V0::Models::CurrencyLabelFormatter

Attributes

value[R]

Public Class Methods

ALL() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 18256
def CurrencyLabelFormatter.ALL
  @@all ||= [CurrencyLabelFormatter.strip_trailing_zeros, CurrencyLabelFormatter.symbol_prefix, CurrencyLabelFormatter.symbol_suffix]
end
apply(value) click to toggle source

Returns the instance of CurrencyLabelFormatter for this value, creating a new instance for an unknown value

# File lib/flow_commerce/flow_api_v0_client.rb, line 18241
def CurrencyLabelFormatter.apply(value)
  if value.instance_of?(CurrencyLabelFormatter)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || CurrencyLabelFormatter.new(value))
  end
end
from_string(value) click to toggle source

Returns the instance of CurrencyLabelFormatter for this value, or nil if not found

# File lib/flow_commerce/flow_api_v0_client.rb, line 18251
def CurrencyLabelFormatter.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  CurrencyLabelFormatter.ALL.find { |v| v.value == value }
end
new(value) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 18236
def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end
strip_trailing_zeros() click to toggle source

If a price ends in ‘.00’ or ‘,00’, we remove the cents and just display the price as a whole number. e.g. ‘A$100.00’ becomes ‘A$100’

# File lib/flow_commerce/flow_api_v0_client.rb, line 18262
def CurrencyLabelFormatter.strip_trailing_zeros
  @@_strip_trailing_zeros ||= CurrencyLabelFormatter.new('strip_trailing_zeros')
end
symbol_prefix() click to toggle source

Indicates that a currency symbol should appear as a prefix to the price label. e.g $100

# File lib/flow_commerce/flow_api_v0_client.rb, line 18268
def CurrencyLabelFormatter.symbol_prefix
  @@_symbol_prefix ||= CurrencyLabelFormatter.new('symbol_prefix')
end
symbol_suffix() click to toggle source

Indicates that a currency symbol should appear as a suffix to the price label. e.g 100 $

# File lib/flow_commerce/flow_api_v0_client.rb, line 18274
def CurrencyLabelFormatter.symbol_suffix
  @@_symbol_suffix ||= CurrencyLabelFormatter.new('symbol_suffix')
end

Public Instance Methods

to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 18278
def to_hash
  value
end