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.



6507
6508
6509
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6507

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6505
6506
6507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6505

def value
  @value
end

Class Method Details

.ALLObject



6527
6528
6529
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6527

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



6512
6513
6514
6515
6516
6517
6518
6519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6512

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



6522
6523
6524
6525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6522

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



6532
6533
6534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6532

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

.returnObject

Inbound or return shipment



6537
6538
6539
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6537

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

Instance Method Details

#to_hashObject



6541
6542
6543
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6541

def to_hash
  value
end