Class: Io::Flow::V0::Models::ShipmentRecipient

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

Returns a new instance of ShipmentRecipient.



24465
24466
24467
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24465

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



24463
24464
24465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24463

def value
  @value
end

Class Method Details

.ALLObject



24485
24486
24487
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24485

def ShipmentRecipient.ALL
  @@all ||= [ShipmentRecipient.customer, ShipmentRecipient.return, ShipmentRecipient.crossdock]
end

.apply(value) ⇒ Object

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



24470
24471
24472
24473
24474
24475
24476
24477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24470

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

.crossdockObject

Outbound shipment to a crossdock



24500
24501
24502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24500

def ShipmentRecipient.crossdock
  @@_crossdock ||= ShipmentRecipient.new('crossdock')
end

.customerObject

Outbound shipment to the customer



24490
24491
24492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24490

def ShipmentRecipient.customer
  @@_customer ||= ShipmentRecipient.new('customer')
end

.from_string(value) ⇒ Object

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



24480
24481
24482
24483
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24480

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

.returnObject

Inbound or return shipment



24495
24496
24497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24495

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

Instance Method Details

#to_hashObject



24504
24505
24506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24504

def to_hash
  value
end