Class: Dor::Services::Client
- Inherits:
-
Object
- Object
- Dor::Services::Client
- Includes:
- Singleton
- Defined in:
- lib/dor/services/client.rb,
lib/dor/services/client/events.rb,
lib/dor/services/client/object.rb,
lib/dor/services/client/embargo.rb,
lib/dor/services/client/marcxml.rb,
lib/dor/services/client/members.rb,
lib/dor/services/client/objects.rb,
lib/dor/services/client/version.rb,
lib/dor/services/client/metadata.rb,
lib/dor/services/client/accession.rb,
lib/dor/services/client/workspace.rb,
lib/dor/services/client/collections.rb,
lib/dor/services/client/async_result.rb,
lib/dor/services/client/release_tags.rb,
lib/dor/services/client/object_version.rb,
lib/dor/services/client/virtual_objects.rb,
lib/dor/services/client/versioned_service.rb,
lib/dor/services/client/connection_wrapper.rb,
lib/dor/services/client/administrative_tags.rb,
lib/dor/services/client/background_job_results.rb,
lib/dor/services/client/error_faraday_middleware.rb,
lib/dor/services/client/response_error_formatter.rb,
lib/dor/services/client/administrative_tag_search.rb
Defined Under Namespace
Classes: Accession, AdministrativeTagSearch, AdministrativeTags, AsyncResult, BackgroundJobResults, Collections, ConflictResponse, ConnectionFailed, ConnectionWrapper, Embargo, Error, ErrorFaradayMiddleware, Events, MalformedResponse, Marcxml, Members, Metadata, NotFoundResponse, Object, ObjectVersion, Objects, ReleaseTags, ResponseErrorFormatter, UnauthorizedResponse, UnexpectedResponse, VersionedService, VirtualObjects, Workspace
Constant Summary collapse
- DEFAULT_VERSION =
'v1'
- TOKEN_HEADER =
'Authorization'
- VERSION =
'6.12.0'
Instance Attribute Summary collapse
-
#connection ⇒ Object
writeonly
Sets the attribute connection.
-
#enable_get_retries ⇒ Object
writeonly
Sets the attribute enable_get_retries.
-
#token ⇒ Object
writeonly
Sets the attribute token.
-
#url ⇒ Object
writeonly
Sets the attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#administrative_tags ⇒ Dor::Services::Client::AdministrativeTagSearch
An instance of the ‘Client::AdministrativeTagSearch` class.
-
#background_job_results ⇒ Dor::Services::Client::BackgroundJobResults
An instance of the ‘Client::BackgroundJobResults` class.
-
#marcxml ⇒ Dor::Services::Client::Marcxml
An instance of the ‘Client::Marcxml` class.
-
#object(object_identifier) ⇒ Dor::Services::Client::Object
An instance of the ‘Client::Object` class.
-
#objects ⇒ Dor::Services::Client::Objects
An instance of the ‘Client::Objects` class.
-
#virtual_objects ⇒ Dor::Services::Client::VirtualObjects
An instance of the ‘Client::VirtualObjects` class.
Instance Attribute Details
#connection=(value) ⇒ Object
Sets the attribute connection
106 107 108 |
# File 'lib/dor/services/client.rb', line 106 def connection=(value) @connection = value end |
#enable_get_retries=(value) ⇒ Object
Sets the attribute enable_get_retries
106 107 108 |
# File 'lib/dor/services/client.rb', line 106 def enable_get_retries=(value) @enable_get_retries = value end |
#token=(value) ⇒ Object
Sets the attribute token
106 107 108 |
# File 'lib/dor/services/client.rb', line 106 def token=(value) @token = value end |
#url=(value) ⇒ Object
Sets the attribute url
106 107 108 |
# File 'lib/dor/services/client.rb', line 106 def url=(value) @url = value end |
Class Method Details
.configure(url:, token:, enable_get_retries: false) ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/dor/services/client.rb', line 91 def configure(url:, token:, enable_get_retries: false) instance.url = url instance.token = token instance.enable_get_retries = enable_get_retries # Force connection to be re-established when `.configure` is called instance.connection = nil self end |
Instance Method Details
#administrative_tags ⇒ Dor::Services::Client::AdministrativeTagSearch
Returns an instance of the ‘Client::AdministrativeTagSearch` class.
63 64 65 |
# File 'lib/dor/services/client.rb', line 63 def @administrative_tags ||= AdministrativeTagSearch.new(connection: connection, version: DEFAULT_VERSION) end |
#background_job_results ⇒ Dor::Services::Client::BackgroundJobResults
Returns an instance of the ‘Client::BackgroundJobResults` class.
78 79 80 |
# File 'lib/dor/services/client.rb', line 78 def background_job_results @background_job_results ||= BackgroundJobResults.new(connection: connection, version: DEFAULT_VERSION) end |
#marcxml ⇒ Dor::Services::Client::Marcxml
Returns an instance of the ‘Client::Marcxml` class.
83 84 85 |
# File 'lib/dor/services/client.rb', line 83 def marcxml @marcxml ||= Marcxml.new(connection: connection, version: DEFAULT_VERSION) end |
#object(object_identifier) ⇒ Dor::Services::Client::Object
Returns an instance of the ‘Client::Object` class.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/dor/services/client.rb', line 51 def object(object_identifier) raise ArgumentError, '`object_identifier` argument cannot be `nil` in call to `#object(object_identifier)' if object_identifier.nil? # Return memoized object instance if object identifier value is the same # This allows us to test the client more easily in downstream codebases, # opening up stubbing without requiring `any_instance_of` return @object if @object&.object_identifier == object_identifier @object = Object.new(connection: connection, version: DEFAULT_VERSION, object_identifier: object_identifier) end |
#objects ⇒ Dor::Services::Client::Objects
Returns an instance of the ‘Client::Objects` class.
68 69 70 |
# File 'lib/dor/services/client.rb', line 68 def objects @objects ||= Objects.new(connection: connection, version: DEFAULT_VERSION) end |
#virtual_objects ⇒ Dor::Services::Client::VirtualObjects
Returns an instance of the ‘Client::VirtualObjects` class.
73 74 75 |
# File 'lib/dor/services/client.rb', line 73 def virtual_objects @virtual_objects ||= VirtualObjects.new(connection: connection, version: DEFAULT_VERSION) end |