class ParcelApi::Pickup

The ParcelPickUp API that notifies PACE or CourierPost to come and pick up your parcel. The integrator provides the pick up location in the form of a site id or an address to create the pick up record.

Constants

PARCELPICKUP_URL

Public Class Methods

new(connection=nil) click to toggle source

Creates a new ParcelApi::Pickup instance.

# File lib/parcel_api/pickup.rb, line 11
def initialize(connection=nil)
  @connection ||= connection || ParcelApi::Client.connection
end

Public Instance Methods

create(pickup_options) click to toggle source

Create a new parcel booking @param pickup_options [Hash] @return Object of pickup details

# File lib/parcel_api/pickup.rb, line 19
def create(pickup_options)
  response = @connection.post PARCELPICKUP_URL, body: pickup_options.to_json.to_ascii, headers: { 'Content-Type' => 'application/json' }
  RecursiveOpenStruct.new(response.parsed, recurse_over_arrays: true)
end