Class: Io::Flow::V0::Models::IncludedLevyKey

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

Returns a new instance of IncludedLevyKey.



8609
8610
8611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8609

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8607
8608
8609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8607

def value
  @value
end

Class Method Details

.ALLObject



8629
8630
8631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8629

def IncludedLevyKey.ALL
  @@all ||= [IncludedLevyKey.duty, IncludedLevyKey.vat, IncludedLevyKey.vat_and_duty]
end

.apply(value) ⇒ Object

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



8614
8615
8616
8617
8618
8619
8620
8621
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8614

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

.dutyObject



8633
8634
8635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8633

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

.from_string(value) ⇒ Object

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



8624
8625
8626
8627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8624

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

.vatObject



8637
8638
8639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8637

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

.vat_and_dutyObject



8641
8642
8643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8641

def IncludedLevyKey.vat_and_duty
  @@_vat_and_duty ||= IncludedLevyKey.new('vat_and_duty')
end

Instance Method Details

#to_hashObject



8645
8646
8647
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8645

def to_hash
  value
end