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.



16455
16456
16457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16455

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16453
16454
16455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16453

def value
  @value
end

Class Method Details

.ALLObject



16475
16476
16477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16475

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



16460
16461
16462
16463
16464
16465
16466
16467
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16460

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



16470
16471
16472
16473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16470

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



16481
16482
16483
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16481

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

.unpaidObject

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



16487
16488
16489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16487

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

Instance Method Details

#to_hashObject



16491
16492
16493
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16491

def to_hash
  value
end