class EasyPost::Services::Pickup
Public Instance Methods
Source
# File lib/easypost/services/pickup.rb, line 22 def all(params = {}) filters = { key: 'pickups' } get_all_helper('pickups', MODEL_CLASS, params, filters) end
Retrieve all Pickup
objects
Source
# File lib/easypost/services/pickup.rb, line 29 def buy(id, params = {}) if params.instance_of?(EasyPost::Models::PickupRate) params = { carrier: params[:carrier], service: params[:service] } end response = @client.make_request(:post, "pickups/#{id}/buy", params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Buy a Pickup
Source
# File lib/easypost/services/pickup.rb, line 40 def cancel(id, params = {}) response = @client.make_request(:post, "pickups/#{id}/cancel", params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Cancel a Pickup
Source
# File lib/easypost/services/pickup.rb, line 7 def create(params = {}) wrapped_params = { pickup: params } response = @client.make_request(:post, 'pickups', wrapped_params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Create a Pickup
object
Source
# File lib/easypost/services/pickup.rb, line 47 def get_next_page(collection, page_size = nil) raise EasyPost::Errors::EndOfPaginationError.new unless more_pages?(collection) params = { before_id: collection.pickups.last.id } params[:page_size] = page_size unless page_size.nil? all(params) end
Get next page of Pickups
Source
# File lib/easypost/services/pickup.rb, line 15 def retrieve(id) response = @client.make_request(:get, "pickups/#{id}") EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Retrieve a Pickup
object