Class: Io::Flow::V0::Models::DeliveredDuty

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

Returns a new instance of DeliveredDuty.



7744
7745
7746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7744

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7742
7743
7744
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7742

def value
  @value
end

Class Method Details

.ALLObject



7764
7765
7766
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7764

def DeliveredDuty.ALL
  @@all ||= [DeliveredDuty.paid, DeliveredDuty.unpaid]
end

.apply(value) ⇒ Object

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



7749
7750
7751
7752
7753
7754
7755
7756
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7749

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

.from_string(value) ⇒ Object

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



7759
7760
7761
7762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7759

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

Delivered Duty Paid (DDP). See en.wikipedia.org/wiki/Incoterms for more information



7770
7771
7772
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7770

def DeliveredDuty.paid
  @@_paid ||= DeliveredDuty.new('paid')
end

.unpaidObject

Delivered Duty Unpaid (DDU). See en.wikipedia.org/wiki/Incoterms for more information



7776
7777
7778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7776

def DeliveredDuty.unpaid
  @@_unpaid ||= DeliveredDuty.new('unpaid')
end

Instance Method Details

#to_hashObject



7780
7781
7782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7780

def to_hash
  value
end