module Shippo::API::Operations::Batch
Public Instance Methods
add_shipment(id, shipments=[])
click to toggle source
Adds a new shipment to a batch object @param [String] id The ID of the Batch
object @param [Array] shipments Array of shipment objects to be added
# File lib/shippo/api/operations/batch.rb, line 16 def add_shipment(id, shipments=[]) response = Shippo::API.post("#{url}/#{CGI.escape(id)}/add_shipments", shipments) self.from(response) end
get(id, params={})
click to toggle source
Retrieves a Batch
by its ID @param [String] id The ID of the Batch
object @param [Hash] params Optional params tacked onto the URL as URI parameters
# File lib/shippo/api/operations/batch.rb, line 8 def get(id, params={}) response = Shippo::API.get("#{url}/#{CGI.escape(id)}", params) self.from(response) end
purchase(id)
click to toggle source
Purchases an existing batch @param [String] id The ID of the Batch
object
# File lib/shippo/api/operations/batch.rb, line 31 def purchase(id) response = Shippo::API.post("#{url}/#{CGI.escape(id)}/purchase") self.from(response) end
remove_shipment(id, shipment_ids=[])
click to toggle source
Removes an existing shipment from a batch object @param [String] id The ID of the Batch
object @param [Array] shipment_ids Array of shipment IDs to be removed
# File lib/shippo/api/operations/batch.rb, line 24 def remove_shipment(id, shipment_ids=[]) response = Shippo::API.post("#{url}/#{CGI.escape(id)}/remove_shipments", shipment_ids) self.from(response) end