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.



13552
13553
13554
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13552

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13550
13551
13552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13550

def value
  @value
end

Class Method Details

.ALLObject



13572
13573
13574
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13572

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



13557
13558
13559
13560
13561
13562
13563
13564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13557

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



13567
13568
13569
13570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13567

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 https://en.wikipedia.org/wiki/Incoterms for more information



13578
13579
13580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13578

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

.unpaidObject

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



13584
13585
13586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13584

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

Instance Method Details

#to_hashObject



13588
13589
13590
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13588

def to_hash
  value
end