Class: Dor::Services::Client::VersionedService Abstract
- Inherits:
-
Object
- Object
- Dor::Services::Client::VersionedService
- Defined in:
- lib/dor/services/client/versioned_service.rb
Overview
This class is abstract.
API calls to a versioned endpoint
Direct Known Subclasses
Accession, AdministrativeTagSearch, AdministrativeTags, BackgroundJobResults, Collections, Events, Members, Mutate, Object, ObjectVersion, Objects, ReleaseTags, Transfer, UserVersion, VirtualObjects, Workspace
Constant Summary collapse
- EXCEPTION_CLASS =
{ 400 => BadRequestError, 401 => UnauthorizedResponse, 404 => NotFoundResponse, 409 => ConflictResponse, 412 => PreconditionFailedResponse }.freeze
- JSON_API_MIME_TYPE =
'application/vnd.api+json'
Instance Method Summary collapse
-
#async_result(url:) ⇒ Object
Common interface for handling asynchronous results.
-
#initialize(connection:, version:) ⇒ VersionedService
constructor
A new instance of VersionedService.
- #with_querystring(url:, params:) ⇒ Object
Constructor Details
#initialize(connection:, version:) ⇒ VersionedService
Returns a new instance of VersionedService.
18 19 20 21 |
# File 'lib/dor/services/client/versioned_service.rb', line 18 def initialize(connection:, version:) @connection = connection @api_version = version end |
Instance Method Details
#async_result(url:) ⇒ Object
Common interface for handling asynchronous results
24 25 26 |
# File 'lib/dor/services/client/versioned_service.rb', line 24 def async_result(url:) AsyncResult.new(url: url) end |
#with_querystring(url:, params:) ⇒ Object
28 29 30 31 32 |
# File 'lib/dor/services/client/versioned_service.rb', line 28 def with_querystring(url:, params:) return url if params.blank? "#{url}?#{params.to_query}" end |