Class: Shipvine::OutboundShipment

Inherits:
Base
  • Object
show all
Defined in:
lib/shipvine/outbound_shipment.rb

Constant Summary

Constants inherited from Base

Base::WAREHOUSE_XSD_FILE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client, xml_to_hash

Constructor Details

#initialize(shipment_hash) ⇒ OutboundShipment

Returns a new instance of OutboundShipment.



15
16
17
# File 'lib/shipvine/outbound_shipment.rb', line 15

def initialize(shipment_hash)
  @attributes = shipment_hash
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



13
14
15
# File 'lib/shipvine/outbound_shipment.rb', line 13

def attributes
  @attributes
end

Class Method Details

.list(since) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/shipvine/outbound_shipment.rb', line 4

def self.list(since)
  request = self.client.request(:get, '/outbound-shipments', { 'created-since' => since })
  response = self.xml_to_hash(request.body)

  Array.wrap(response[:outbound_shipments][:outbound_shipment]).map do |shipment_hash|
    self.new(shipment_hash)
  end
end

Instance Method Details

#merchant_identifierObject



19
20
21
# File 'lib/shipvine/outbound_shipment.rb', line 19

def merchant_identifier
  @attributes[:fulfillment_request][:merchant_identifier]
end

#wfs_identifierObject Also known as: shipvine_identifier



23
24
25
# File 'lib/shipvine/outbound_shipment.rb', line 23

def wfs_identifier
  @attributes[:fulfillment_request][:wfs_identifier]
end