class Io::Flow::V0::Models::DiscountTarget
Attributes
value[R]
Public Class Methods
ALL()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 19014 def DiscountTarget.ALL @@all ||= [DiscountTarget.item, DiscountTarget.shipping] end
apply(value)
click to toggle source
Returns the instance of DiscountTarget
for this value, creating a new instance for an unknown value
# File lib/flow_commerce/flow_api_v0_client.rb, line 18999 def DiscountTarget.apply(value) if value.instance_of?(DiscountTarget) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || DiscountTarget.new(value)) end end
from_string(value)
click to toggle source
Returns the instance of DiscountTarget
for this value, or nil if not found
# File lib/flow_commerce/flow_api_v0_client.rb, line 19009 def DiscountTarget.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) DiscountTarget.ALL.find { |v| v.value == value } end
item()
click to toggle source
Discount
is targeted to an item.
# File lib/flow_commerce/flow_api_v0_client.rb, line 19019 def DiscountTarget.item @@_item ||= DiscountTarget.new('item') end
new(value)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 18994 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end
shipping()
click to toggle source
Discount
is targeting to shipping. Only applicable if the discount is provided at the order level.
# File lib/flow_commerce/flow_api_v0_client.rb, line 19025 def DiscountTarget.shipping @@_shipping ||= DiscountTarget.new('shipping') end
Public Instance Methods
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 19029 def to_hash value end