Class: GoCardlessPro::Services::PayerThemesService

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

Overview

Service for making requests to the PayerTheme 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

#create_for_creditor(options = {}) ⇒ Object

Creates a new payer theme associated with a creditor. If a creditor already has payer themes, this will update the existing payer theme linked to the creditor. Example URL: /branding/payer_themes

Parameters:

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

    parameters as a hash, under a params key.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gocardless_pro/services/payer_themes_service.rb', line 18

def create_for_creditor(options = {})
  path = '/branding/payer_themes'

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

  options[:retry_failures] = true

  response = make_request(:post, path, options)

  return if response.body.nil?

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