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.



14090
14091
14092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14090

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14088
14089
14090
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14088

def value
  @value
end

Class Method Details

.ALLObject



14110
14111
14112
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14110

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



14095
14096
14097
14098
14099
14100
14101
14102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14095

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



14120
14121
14122
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14120

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



14105
14106
14107
14108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14105

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

.vatObject

VAT subsidy



14115
14116
14117
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14115

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

Instance Method Details

#to_hashObject



14124
14125
14126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14124

def to_hash
  value
end