Class: GoCardlessPro::Services::CustomerNotificationsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/gocardless_pro/services/customer_notifications_service.rb

Overview

Service for making requests to the CustomerNotification endpoints

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request, #sub_url

Constructor Details

This class inherits a constructor from GoCardlessPro::Services::BaseService

Instance Method Details

#handle(identity, options = {}) ⇒ Object

“Handling” a notification means that you have sent the notification yourself (and don’t want GoCardless to send it). If the notification has already been actioned, or the deadline to notify has passed, this endpoint will return an ‘already_actioned` error and you should not take further action. This endpoint takes no additional parameters.

Example URL: /customer_notifications/:identity/actions/handle

Parameters:

  • identity

    # The id of the notification.

  • options (Hash) (defaults to: {})

    parameters as a hash, under a params key.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gocardless_pro/services/customer_notifications_service.rb', line 25

def handle(identity, options = {})
  path = sub_url('/customer_notifications/:identity/actions/handle', 'identity' => identity)

  params = options.delete(:params) || {}
  options[:params] = {}
  options[:params]['data'] = params

  options[:retry_failures] = false

  response = make_request(:post, path, options)

  return if response.body.nil?

  Resources::CustomerNotification.new(unenvelope_body(response.body), response)
end