class Io::Flow::V0::Models::PromotionTriggerType

Attributes

value[R]

Public Class Methods

ALL() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 25530
def PromotionTriggerType.ALL
  @@all ||= [PromotionTriggerType.automatic, PromotionTriggerType.order_subtotal]
end
apply(value) click to toggle source

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

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

Automatic indicates the the promotion will be automatically applied to the order

# File lib/flow_commerce/flow_api_v0_client.rb, line 25536
def PromotionTriggerType.automatic
  @@_automatic ||= PromotionTriggerType.new('automatic')
end
from_string(value) click to toggle source

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

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

Order subtotal sets a minimum value - orders whose subtotal is greater than the minimum will have the promotion applied. A common use case is to offer free shipping to orders about 150 CAD.

# File lib/flow_commerce/flow_api_v0_client.rb, line 25543
def PromotionTriggerType.order_subtotal
  @@_order_subtotal ||= PromotionTriggerType.new('order_subtotal')
end

Public Instance Methods

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