class ParcelApi::Notification

Creates a PCD (collection point) subscription with provided delivery email address and tracking reference. Customers will receive an email when the parcel reaches the collection point and then subsequent reminders.

Constants

PARCELNOTIFICATION_URL

Public Class Methods

new(connection=nil) click to toggle source

Creates a new ParcelApi::Notification instance.

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

Public Instance Methods

create(notification_options) click to toggle source

Create a new parcel notification @param notification_options [Hash] @return Object of notification details

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