Class: Io::Flow::V0::Models::Direction

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

Returns a new instance of Direction.



9129
9130
9131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9129

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9127
9128
9129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9127

def value
  @value
end

Class Method Details

.ALLObject



9149
9150
9151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9149

def Direction.ALL
  @@all ||= [Direction.outbound, Direction.return]
end

.apply(value) ⇒ Object

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



9134
9135
9136
9137
9138
9139
9140
9141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9134

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

.from_string(value) ⇒ Object

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



9144
9145
9146
9147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9144

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

.outboundObject

Outbound shipment to typically fulfill a customer order



9154
9155
9156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9154

def Direction.outbound
  @@_outbound ||= Direction.new('outbound')
end

.returnObject

Inbound or return shipment



9159
9160
9161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9159

def Direction.return
  @@_return ||= Direction.new('return')
end

Instance Method Details

#to_hashObject



9163
9164
9165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9163

def to_hash
  value
end