Class: Assinafy::Resources::BaseResource
- Inherits:
-
Object
- Object
- Assinafy::Resources::BaseResource
- Defined in:
- lib/assinafy/resources/base_resource.rb,
sig/assinafy.rbs
Overview
Shared plumbing for every resource: a Faraday connection, an optional
default account ID, parameter normalisation, response-envelope handling,
pagination header parsing, and a single request/call pipeline that
wraps Faraday and Assinafy errors into the SDK's own error hierarchy.
Direct Known Subclasses
AccountResource, AssignmentResource, AuthResource, DocumentResource, FieldResource, SignerDocumentResource, SignerResource, TagResource, TemplateResource, UserResource, WebhookResource
Constant Summary collapse
- PATH_SEGMENT =
/\A[A-Za-z0-9._~-]+\z/- AUTH_HEADERS =
%w[X-Api-Key Authorization].freeze
- PAGINATION_HEADERS =
{ current_page: 'x-pagination-current-page', per_page: 'x-pagination-per-page', total: 'x-pagination-total-count', last_page: 'x-pagination-page-count' }.freeze
Instance Method Summary collapse
-
#initialize(connection, default_account_id = nil, logger = nil) ⇒ BaseResource
constructor
A new instance of BaseResource.
Constructor Details
#initialize(connection, default_account_id = nil, logger = nil) ⇒ BaseResource
Returns a new instance of BaseResource.
22 23 24 25 26 27 |
# File 'lib/assinafy/resources/base_resource.rb', line 22 def initialize(connection, default_account_id = nil, logger = nil) @connection = connection @connection.headers['User-Agent'] = USER_AGENT @default_account_id = default_account_id.is_a?(String) ? default_account_id.dup.freeze : default_account_id @logger = logger || NullLogger.new end |