Class: GoCardlessPro::Services::MandateImportEntriesService

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

Overview

Service for making requests to the MandateImportEntry endpoints

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request

Constructor Details

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

Instance Method Details

#all(options = {}) ⇒ Object

Get a lazily enumerated list of all the items returned. This is simmilar to the ‘list` method but will paginate for you automatically.

Otherwise they will be the body of the request.

Parameters:

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

    parameters as a hash. If the request is a GET, these will be converted to query parameters.



68
69
70
71
72
73
# File 'lib/gocardless_pro/services/mandate_import_entries_service.rb', line 68

def all(options = {})
  Paginator.new(
    service: self,
    options: options
  ).enumerator
end

#create(options = {}) ⇒ Object

For an existing [mandate import](#core-endpoints-mandate-imports), this endpoint can be used to add individual mandates to be imported into GoCardless.

You can add no more than 30,000 rows to a single mandate import. If you attempt to go over this limit, the API will return a ‘record_limit_exceeded` error. Example URL: /mandate_import_entries

Parameters:

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

    parameters as a hash, under a params key.



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

def create(options = {})
  path = '/mandate_import_entries'

  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::MandateImportEntry.new(unenvelope_body(response.body), response)
end

#list(options = {}) ⇒ Object

For an existing mandate import, this endpoint lists all of the entries attached.

After a mandate import has been submitted, you can use this endpoint to associate records in your system (using the ‘record_identifier` that you provided when creating the mandate import).

Example URL: /mandate_import_entries

Parameters:

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

    parameters as a hash, under a params key.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/gocardless_pro/services/mandate_import_entries_service.rb', line 50

def list(options = {})
  path = '/mandate_import_entries'

  options[:retry_failures] = true

  response = make_request(:get, path, options)

  ListResponse.new(
    response: response,
    unenveloped_body: unenvelope_body(response.body),
    resource_class: Resources::MandateImportEntry
  )
end