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.



8315
8316
8317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8315

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8313
8314
8315
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8313

def value
  @value
end

Class Method Details

.ALLObject



8335
8336
8337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8335

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



8320
8321
8322
8323
8324
8325
8326
8327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8320

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



8330
8331
8332
8333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8330

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



8341
8342
8343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8341

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

.unpaidObject

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



8347
8348
8349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8347

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

Instance Method Details

#to_hashObject



8351
8352
8353
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8351

def to_hash
  value
end