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.



12567
12568
12569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12567

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12565
12566
12567
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12565

def value
  @value
end

Class Method Details

.ALLObject



12587
12588
12589
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12587

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



12572
12573
12574
12575
12576
12577
12578
12579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12572

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



12602
12603
12604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12602

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

.customerObject

Outbound shipment to the customer



12592
12593
12594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12592

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



12582
12583
12584
12585
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12582

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



12597
12598
12599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12597

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

Instance Method Details

#to_hashObject



12606
12607
12608
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12606

def to_hash
  value
end