Sha256: 7c0b26902703c4bbc9219beb73cbec974ae01ade95d06a996e87f3d3a2d00e8f
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true # The Pickup object allows you to schedule a pickup from your carrier from your customer's residence or place of business. class EasyPost::Pickup < EasyPost::Resource # Buy a Pickup. def buy(params = {}) if params.instance_of?(EasyPost::PickupRate) temp = params.clone params = {} params[:carrier] = temp.carrier params[:service] = temp.service end response = EasyPost.make_request(:post, "#{url}/buy", @api_key, params) refresh_from(response, @api_key) self end # Cancel a Pickup. def cancel(params = {}) response = EasyPost.make_request(:post, "#{url}/cancel", @api_key, params) refresh_from(response, @api_key) self end # Retrieve a list of all Pickup objects. def self.all(_filters = {}, _api_key = nil) raise NotImplementedError.new('Pickup.all not implemented.') end # Get the lowest rate of a Pickup (can exclude by having `'!'` as the first element of your optional filter lists). def lowest_rate(carriers = [], services = []) EasyPost::Util.get_lowest_object_rate(self, carriers, services, 'pickup_rates') end end
Version data entries
5 entries across 5 versions & 1 rubygems