Sha256: f0ab5bd6300960ce5f00864353d3781ccdc68b0cc8677f7edc6458c2a0e5e1cb

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

module ParcelApi

  # 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.

  class Pickup
    PARCELPICKUP_URL = '/ParcelPickUp/2.0/bookings'

    # Creates a new ParcelApi::Pickup instance.

    def initialize(connection=nil)
      @connection ||= connection || ParcelApi::Client.connection
    end

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

    def create(pickup_options)
      response = @connection.post PARCELPICKUP_URL, pickup_options
      RecursiveOpenStruct.new(response.body, recurse_over_arrays: true)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
parcel_api-0.4.1 lib/parcel_api/pickup.rb
parcel_api-0.3.0 lib/parcel_api/pickup.rb
parcel_api-0.2.0 lib/parcel_api/pickup.rb