Class: GoCardless::Services::BaseService
- Inherits:
-
Object
- Object
- GoCardless::Services::BaseService
- Defined in:
- lib/gocardless-pro/services/base_service.rb
Overview
Base Service that all services inherit from.
Direct Known Subclasses
ApiKeyService, CreditorBankAccountService, CreditorService, CustomerBankAccountService, CustomerService, EventService, HelperService, MandateService, PaymentService, PayoutService, PublishableApiKeyService, RedirectFlowService, RefundService, RoleService, SubscriptionService, UserService
Instance Method Summary collapse
-
#envelope_key ⇒ Object
Get the envelope key for the given service.
-
#initialize(api_service) ⇒ BaseService
constructor
Create a new service instance to make requests against.
-
#make_request(method, path, options = {}, custom_headers = {}) ⇒ Object
Make a request to the API using the API service instance.
Constructor Details
#initialize(api_service) ⇒ BaseService
Create a new service instance to make requests against
9 10 11 |
# File 'lib/gocardless-pro/services/base_service.rb', line 9 def initialize(api_service) @api_service = api_service end |
Instance Method Details
#envelope_key ⇒ Object
Get the envelope key for the given service. Children are expected to implement this method.
24 25 26 |
# File 'lib/gocardless-pro/services/base_service.rb', line 24 def envelope_key fail NotImplementedError end |
#make_request(method, path, options = {}, custom_headers = {}) ⇒ Object
Make a request to the API using the API service instance
19 20 21 |
# File 'lib/gocardless-pro/services/base_service.rb', line 19 def make_request(method, path, = {}, custom_headers = {}) @api_service.make_request(method, path, .merge(envelope_key: envelope_key), custom_headers) end |