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.



16857
16858
16859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16857

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16855
16856
16857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16855

def value
  @value
end

Class Method Details

.ALLObject



16877
16878
16879
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16877

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



16862
16863
16864
16865
16866
16867
16868
16869
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16862

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



16887
16888
16889
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16887

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



16872
16873
16874
16875
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16872

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

.vatObject

VAT subsidy



16882
16883
16884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16882

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

Instance Method Details

#to_hashObject



16891
16892
16893
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16891

def to_hash
  value
end