Class: Dor::Services::Client
- Inherits:
-
Object
- Object
- Dor::Services::Client
- Includes:
- Singleton
- Defined in:
- lib/dor/services/client.rb,
lib/dor/services/client/sdr.rb,
lib/dor/services/client/files.rb,
lib/dor/services/client/object.rb,
lib/dor/services/client/objects.rb,
lib/dor/services/client/version.rb,
lib/dor/services/client/workflow.rb,
lib/dor/services/client/workflows.rb,
lib/dor/services/client/workspace.rb,
lib/dor/services/client/release_tags.rb,
lib/dor/services/client/versioned_service.rb,
lib/dor/services/client/error_faraday_middleware.rb
Defined Under Namespace
Classes: ConnectionFailed, Error, ErrorFaradayMiddleware, Files, MalformedResponse, NotFoundResponse, Object, Objects, ReleaseTags, SDR, UnexpectedResponse, VersionedService, Workflow, Workflows, Workspace
Constant Summary collapse
- DEFAULT_VERSION =
'v1'- VERSION =
'1.7.0'
Instance Attribute Summary collapse
-
#connection ⇒ Object
writeonly
Sets the attribute connection.
-
#password ⇒ Object
writeonly
Sets the attribute password.
-
#url ⇒ Object
writeonly
Sets the attribute url.
-
#username ⇒ Object
writeonly
Sets the attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#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.
- #workflows ⇒ Object
Instance Attribute Details
#connection=(value) ⇒ Object
Sets the attribute connection
72 73 74 |
# File 'lib/dor/services/client.rb', line 72 def connection=(value) @connection = value end |
#password=(value) ⇒ Object
Sets the attribute password
72 73 74 |
# File 'lib/dor/services/client.rb', line 72 def password=(value) @password = value end |
#url=(value) ⇒ Object
Sets the attribute url
72 73 74 |
# File 'lib/dor/services/client.rb', line 72 def url=(value) @url = value end |
#username=(value) ⇒ Object
Sets the attribute username
72 73 74 |
# File 'lib/dor/services/client.rb', line 72 def username=(value) @username = value end |
Class Method Details
.configure(url:, username: nil, password: nil) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/dor/services/client.rb', line 59 def configure(url:, username: nil, password: nil) instance.url = url instance.username = username instance.password = password # Force connection to be re-established when `.configure` is called instance.connection = nil self end |
Instance Method Details
#object(object_identifier) ⇒ Dor::Services::Client::Object
Returns an instance of the ‘Client::Object` class.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/dor/services/client.rb', line 38 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.
50 51 52 |
# File 'lib/dor/services/client.rb', line 50 def objects @objects ||= Objects.new(connection: connection, version: DEFAULT_VERSION) end |
#workflows ⇒ Object
54 55 56 |
# File 'lib/dor/services/client.rb', line 54 def workflows @workflows ||= Workflows.new(connection: connection, version: DEFAULT_VERSION) end |