class GoCardlessPro::Services::InstitutionsService
Service for making requests to the Institution endpoints
Public Instance Methods
Source
# File lib/gocardless_pro/services/institutions_service.rb, line 34 def all(options = {}) Paginator.new( service: self, options: options ).enumerator end
Get a lazily enumerated list of all the items returned. This is similar to the ‘list` method but will paginate for you automatically.
@param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters. Otherwise they will be the body of the request.
Source
# File lib/gocardless_pro/services/institutions_service.rb, line 16 def list(options = {}) path = '/institutions' options[:retry_failures] = true response = make_request(:get, path, options) ListResponse.new( response: response, unenveloped_body: unenvelope_body(response.body), resource_class: Resources::Institution ) end
Returns a list of supported institutions. Example URL: /institutions @param options [Hash] parameters as a hash, under a params key.
Source
# File lib/gocardless_pro/services/institutions_service.rb, line 48 def list_for_billing_request(identity, options = {}) path = sub_url('/billing_requests/:identity/institutions', { 'identity' => identity }) options[:retry_failures] = false response = make_request(:get, path, options) ListResponse.new( response: response, unenveloped_body: unenvelope_body(response.body), resource_class: Resources::Institution ) end
Returns all institutions valid for a Billing Request
.
This endpoint is currently supported only for FasterPayments. Example URL: /billing_requests/:identity/institutions
@param identity # Unique identifier, beginning with “BRQ”. @param options [Hash] parameters as a hash, under a params key.
Private Instance Methods
Source
# File lib/gocardless_pro/services/institutions_service.rb, line 74 def envelope_key 'institutions' end
return the key which API responses will envelope data under
Source
# File lib/gocardless_pro/services/institutions_service.rb, line 69 def unenvelope_body(body) body[envelope_key] || body['data'] end
Unenvelope the response of the body using the service’s ‘envelope_key`
@param body [Hash]