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.



14728
14729
14730
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14728

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14726
14727
14728
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14726

def value
  @value
end

Class Method Details

.ALLObject



14748
14749
14750
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14748

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



14733
14734
14735
14736
14737
14738
14739
14740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14733

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



14758
14759
14760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14758

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



14743
14744
14745
14746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14743

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

.vatObject

VAT subsidy



14753
14754
14755
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14753

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

Instance Method Details

#to_hashObject



14762
14763
14764
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14762

def to_hash
  value
end