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.



9064
9065
9066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9064

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9062
9063
9064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9062

def value
  @value
end

Class Method Details

.ALLObject



9084
9085
9086
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9084

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



9069
9070
9071
9072
9073
9074
9075
9076
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9069

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



9079
9080
9081
9082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9079

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



9090
9091
9092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9090

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

.unpaidObject

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



9096
9097
9098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9096

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

Instance Method Details

#to_hashObject



9100
9101
9102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9100

def to_hash
  value
end