Class: Io::Flow::V0::Models::DiscountRuleSubsidyTarget

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) ⇒ DiscountRuleSubsidyTarget

Returns a new instance of DiscountRuleSubsidyTarget.



15025
15026
15027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15025

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15023
15024
15025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15023

def value
  @value
end

Class Method Details

.ALLObject



15045
15046
15047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15045

def DiscountRuleSubsidyTarget.ALL
  @@all ||= [DiscountRuleSubsidyTarget.vat, DiscountRuleSubsidyTarget.duty]
end

.apply(value) ⇒ Object

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



15030
15031
15032
15033
15034
15035
15036
15037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15030

def DiscountRuleSubsidyTarget.apply(value)
  if value.instance_of?(DiscountRuleSubsidyTarget)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || DiscountRuleSubsidyTarget.new(value))
  end
end

.dutyObject

Duty subsidy



15055
15056
15057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15055

def DiscountRuleSubsidyTarget.duty
  @@_duty ||= DiscountRuleSubsidyTarget.new('duty')
end

.from_string(value) ⇒ Object

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



15040
15041
15042
15043
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15040

def DiscountRuleSubsidyTarget.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  DiscountRuleSubsidyTarget.ALL.find { |v| v.value == value }
end

.vatObject

VAT subsidy



15050
15051
15052
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050

def DiscountRuleSubsidyTarget.vat
  @@_vat ||= DiscountRuleSubsidyTarget.new('vat')
end

Instance Method Details

#to_hashObject



15059
15060
15061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15059

def to_hash
  value
end