Module: Shippo::API::Operations::Batch
- Defined in:
- lib/shippo/api/operations/batch.rb
Instance Method Summary collapse
-
#add_shipment(id, shipments = []) ⇒ Object
Adds a new shipment to a batch object.
-
#get(id, params = {}) ⇒ Object
Retrieves a Batch by its ID.
-
#purchase(id) ⇒ Object
Purchases an existing batch.
-
#remove_shipment(id, shipment_ids = []) ⇒ Object
Removes an existing shipment from a batch object.
Instance Method Details
#add_shipment(id, shipments = []) ⇒ Object
Adds a new shipment to a batch object
16 17 18 19 |
# 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 = {}) ⇒ Object
Retrieves a Batch by its ID
8 9 10 11 |
# 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) ⇒ Object
Purchases an existing batch
31 32 33 34 |
# 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 = []) ⇒ Object
Removes an existing shipment from a batch object
24 25 26 27 |
# 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 |