Sha256: 9e2f0a8de18b2ec1988a6fd85bebc6d87f12052810e6150fb22142b621640b15
Contents?: true
Size: 914 Bytes
Versions: 2
Compression:
Stored size: 914 Bytes
Contents
module ParcelApi # 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. class Notification PARCELNOTIFICATION_URL = '/parcelnotifications/v1/subscription/pcd' # Creates a new ParcelApi::Notification instance. def initialize(connection=nil) @connection ||= connection || ParcelApi::Client.connection end # Create a new parcel notification # @param notification_options [Hash] # @return Object of notification details 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parcel_api-1.2.1 | lib/parcel_api/notification.rb |
parcel_api-1.2.0 | lib/parcel_api/notification.rb |