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.



14631
14632
14633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14631

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14629
14630
14631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14629

def value
  @value
end

Class Method Details

.ALLObject



14651
14652
14653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14651

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



14636
14637
14638
14639
14640
14641
14642
14643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14636

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



14646
14647
14648
14649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14646

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



14657
14658
14659
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14657

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

.unpaidObject

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



14663
14664
14665
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14663

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

Instance Method Details

#to_hashObject



14667
14668
14669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14667

def to_hash
  value
end