Class: Io::Flow::V0::Models::GoodsSupply

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) ⇒ GoodsSupply

Returns a new instance of GoodsSupply.



16008
16009
16010
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16008

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16006
16007
16008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16006

def value
  @value
end

Class Method Details

.ALLObject



16028
16029
16030
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16028

def GoodsSupply.ALL
  @@all ||= [GoodsSupply.export, GoodsSupply.intra_community, GoodsSupply.local]
end

.apply(value) ⇒ Object

Returns the instance of GoodsSupply for this value, creating a new instance for an unknown value



16013
16014
16015
16016
16017
16018
16019
16020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16013

def GoodsSupply.apply(value)
  if value.instance_of?(GoodsSupply)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || GoodsSupply.new(value))
  end
end

.exportObject

Goods will be supplied from a DC from outside the national and customs boundaries of the destination.



16034
16035
16036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16034

def GoodsSupply.export
  @@_export ||= GoodsSupply.new('export')
end

.from_string(value) ⇒ Object

Returns the instance of GoodsSupply for this value, or nil if not found



16023
16024
16025
16026
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16023

def GoodsSupply.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  GoodsSupply.ALL.find { |v| v.value == value }
end

.intra_communityObject

Goods will be supplied from a DC outside the national boundries of the destination, but within the same customs union.



16040
16041
16042
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16040

def GoodsSupply.intra_community
  @@_intra_community ||= GoodsSupply.new('intra_community')
end

.localObject

Goods will be supplied from a DC within the same country as the destination.



16045
16046
16047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16045

def GoodsSupply.local
  @@_local ||= GoodsSupply.new('local')
end

Instance Method Details

#to_hashObject



16049
16050
16051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16049

def to_hash
  value
end