Class: Io::Flow::V0::Models::LevyComponent

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) ⇒ LevyComponent

Returns a new instance of LevyComponent.



12833
12834
12835
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12833

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12831
12832
12833
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12831

def value
  @value
end

Class Method Details

.ALLObject



12853
12854
12855
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12853

def LevyComponent.ALL
  @@all ||= [LevyComponent.goods, LevyComponent.duty, LevyComponent.insurance, LevyComponent.freight, LevyComponent.vat]
end

.apply(value) ⇒ Object

Returns the instance of LevyComponent for this value, creating a new instance for an unknown value



12838
12839
12840
12841
12842
12843
12844
12845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12838

def LevyComponent.apply(value)
  if value.instance_of?(LevyComponent)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || LevyComponent.new(value))
  end
end

.dutyObject



12862
12863
12864
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12862

def LevyComponent.duty
  @@_duty ||= LevyComponent.new('duty')
end

.freightObject



12870
12871
12872
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12870

def LevyComponent.freight
  @@_freight ||= LevyComponent.new('freight')
end

.from_string(value) ⇒ Object

Returns the instance of LevyComponent for this value, or nil if not found



12848
12849
12850
12851
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12848

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

.goodsObject

The value of goods



12858
12859
12860
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12858

def LevyComponent.goods
  @@_goods ||= LevyComponent.new('goods')
end

.insuranceObject



12866
12867
12868
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12866

def LevyComponent.insurance
  @@_insurance ||= LevyComponent.new('insurance')
end

.vatObject

Value-Added Tax



12875
12876
12877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12875

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

Instance Method Details

#to_hashObject



12879
12880
12881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12879

def to_hash
  value
end