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.



19103
19104
19105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19103

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19101
19102
19103
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19101

def value
  @value
end

Class Method Details

.ALLObject



19123
19124
19125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19123

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



19108
19109
19110
19111
19112
19113
19114
19115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19108

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



19138
19139
19140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19138

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

.customerObject

Outbound shipment to the customer



19128
19129
19130
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19128

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



19118
19119
19120
19121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19118

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



19133
19134
19135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19133

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

Instance Method Details

#to_hashObject



19142
19143
19144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19142

def to_hash
  value
end