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.



17580
17581
17582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17580

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17578
17579
17580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17578

def value
  @value
end

Class Method Details

.ALLObject



17600
17601
17602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17600

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



17585
17586
17587
17588
17589
17590
17591
17592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17585

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



17610
17611
17612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17610

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



17595
17596
17597
17598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17595

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

.vatObject

VAT subsidy



17605
17606
17607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17605

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

Instance Method Details

#to_hashObject



17614
17615
17616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17614

def to_hash
  value
end