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.



18950
18951
18952
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18950

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18948
18949
18950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18948

def value
  @value
end

Class Method Details

.ALLObject



18970
18971
18972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18970

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



18955
18956
18957
18958
18959
18960
18961
18962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18955

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



18980
18981
18982
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18980

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



18965
18966
18967
18968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18965

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

.vatObject

VAT subsidy



18975
18976
18977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18975

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

Instance Method Details

#to_hashObject



18984
18985
18986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18984

def to_hash
  value
end