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.



15153
15154
15155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15153

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15151
15152
15153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15151

def value
  @value
end

Class Method Details

.ALLObject



15173
15174
15175
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15173

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



15158
15159
15160
15161
15162
15163
15164
15165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15158

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



15183
15184
15185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15183

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



15168
15169
15170
15171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15168

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

.vatObject

VAT subsidy



15178
15179
15180
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15178

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

Instance Method Details

#to_hashObject



15187
15188
15189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15187

def to_hash
  value
end