class GoCardlessPro::Services::CustomerNotificationsService
Service for making requests to the CustomerNotification endpoints
Public Instance Methods
handle(identity, options = {})
click to toggle source
“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
@param identity # The id of the notification. @param options [Hash] parameters as a hash, under a params key.
# 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
Private Instance Methods
envelope_key()
click to toggle source
return the key which API responses will envelope data under
# File lib/gocardless_pro/services/customer_notifications_service.rb, line 51 def envelope_key 'customer_notifications' end
unenvelope_body(body)
click to toggle source
Unenvelope the response of the body using the service's `envelope_key`
@param body [Hash]
# File lib/gocardless_pro/services/customer_notifications_service.rb, line 46 def unenvelope_body(body) body[envelope_key] || body['data'] end