class EasyPost::Services::ScanForm

Constants

MODEL_CLASS

A ScanForm can be created to speed up and simplify the carrier pickup process. The ScanForm is one document that can be scanned to mark all included tracking codes as “Accepted for Shipment” by the carrier.

Public Instance Methods

all(params = {}) click to toggle source

Retrieve a list of ScanForms

# File lib/easypost/services/scan_form.rb, line 21
def all(params = {})
  filters = { key: 'scan_forms' }

  get_all_helper('scan_forms', MODEL_CLASS, params, filters)
end
create(params = {}) click to toggle source

Create a ScanForm.

# File lib/easypost/services/scan_form.rb, line 7
def create(params = {})
  response = @client.make_request(:post, 'scan_forms', params)

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
end
get_next_page(collection, page_size = nil) click to toggle source

Get the next page of ScanForms.

# File lib/easypost/services/scan_form.rb, line 28
def get_next_page(collection, page_size = nil)
  raise EasyPost::Errors::EndOfPaginationError.new unless more_pages?(collection)

  params = { before_id: collection.scan_forms.last.id }
  params[:page_size] = page_size unless page_size.nil?

  all(params)
end
retrieve(id) click to toggle source

Retrieve a ScanForm.

# File lib/easypost/services/scan_form.rb, line 14
def retrieve(id)
  response = @client.make_request(:get, "scan_forms/#{id}")

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
end