class Io::Flow::V0::Models::RoundingType

Attributes

value[R]

Public Class Methods

ALL() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 26391
def RoundingType.ALL
  @@all ||= [RoundingType.pattern, RoundingType.multiple]
end
apply(value) click to toggle source

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

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

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

# File lib/flow_commerce/flow_api_v0_client.rb, line 26386
def RoundingType.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  RoundingType.ALL.find { |v| v.value == value }
end
multiple() click to toggle source

Rounds a value to an amount that is the multiple of a value, e.g. rounding to the nearest 5 would ensure that the resulting number ends in either 0 or 5.

# File lib/flow_commerce/flow_api_v0_client.rb, line 26403
def RoundingType.multiple
  @@_multiple ||= RoundingType.new('multiple')
end
new(value) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 26371
def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end
pattern() click to toggle source

Rounds a value to an amount ending with a pattern, e.g. an amount ending in ‘.99’.

# File lib/flow_commerce/flow_api_v0_client.rb, line 26397
def RoundingType.pattern
  @@_pattern ||= RoundingType.new('pattern')
end

Public Instance Methods

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