Sha256: 240d81080dfa3c3bc66b6381beb8ebb33f9a5d36ed7eaa60f8d32cd2edd7d155
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true # The Batch object allows you to perform operations on multiple Shipments at once. class EasyPost::Batch < EasyPost::Resource # Create and buy a batch in one call. 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 # Buy a Batch. def buy(params = {}) response = EasyPost.make_request(:post, "#{url}/buy", @api_key, params) refresh_from(response, @api_key) self end # Convert the label format of a Batch. def label(params = {}) response = EasyPost.make_request(:post, "#{url}/label", @api_key, params) refresh_from(response, @api_key) self end # Remove Shipments from a Batch. def remove_shipments(params = {}) response = EasyPost.make_request(:post, "#{url}/remove_shipments", @api_key, params) refresh_from(response, @api_key) self end # Add Shipments to a Batch. def add_shipments(params = {}) response = EasyPost.make_request(:post, "#{url}/add_shipments", @api_key, params) refresh_from(response, @api_key) self end # Create a ScanForm for a Batch. def create_scan_form(params = {}) EasyPost.make_request(:post, "#{url}/scan_form", @api_key, params) end # TODO: Add support getting the next page of batches when the API supports it. end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
easypost-4.13.1 | lib/easypost/batch.rb |
easypost-4.13.0 | lib/easypost/batch.rb |