class EasyPost::Batch
The Batch
object allows you to perform operations on multiple Shipments at once.
Public Class Methods
create_and_buy(params = {}, api_key = nil)
click to toggle source
Create and buy a batch in one call.
# File lib/easypost/batch.rb, line 6 def self.create_and_buy(params = {}, api_key = nil) wrapped_params = {} wrapped_params[class_name.to_sym] = params response = EasyPost.make_request(:post, "#{url}/create_and_buy", api_key, wrapped_params) EasyPost::Util.convert_to_easypost_object(response, api_key) end
Public Instance Methods
add_shipments(params = {})
click to toggle source
Add Shipments to a Batch
.
# File lib/easypost/batch.rb, line 39 def add_shipments(params = {}) response = EasyPost.make_request(:post, "#{url}/add_shipments", @api_key, params) refresh_from(response, @api_key) self end
buy(params = {})
click to toggle source
Buy a Batch
.
# File lib/easypost/batch.rb, line 15 def buy(params = {}) response = EasyPost.make_request(:post, "#{url}/buy", @api_key, params) refresh_from(response, @api_key) self end
create_scan_form(params = {})
click to toggle source
Create a ScanForm for a Batch
.
# File lib/easypost/batch.rb, line 47 def create_scan_form(params = {}) EasyPost.make_request(:post, "#{url}/scan_form", @api_key, params) end
label(params = {})
click to toggle source
Convert the label format of a Batch
.
# File lib/easypost/batch.rb, line 23 def label(params = {}) response = EasyPost.make_request(:post, "#{url}/label", @api_key, params) refresh_from(response, @api_key) self end
remove_shipments(params = {})
click to toggle source
Remove Shipments from a Batch
.
# File lib/easypost/batch.rb, line 31 def remove_shipments(params = {}) response = EasyPost.make_request(:post, "#{url}/remove_shipments", @api_key, params) refresh_from(response, @api_key) self end