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.



8247
8248
8249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8247

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8245
8246
8247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8245

def value
  @value
end

Class Method Details

.ALLObject



8267
8268
8269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8267

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



8252
8253
8254
8255
8256
8257
8258
8259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8252

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



8262
8263
8264
8265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8262

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



8273
8274
8275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8273

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

.unpaidObject

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



8279
8280
8281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8279

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

Instance Method Details

#to_hashObject



8283
8284
8285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8283

def to_hash
  value
end