Module: Scholarsphere::Client
- Defined in:
- lib/scholarsphere/client.rb,
lib/scholarsphere/client/config.rb,
lib/scholarsphere/client/ingest.rb,
lib/scholarsphere/client/upload.rb,
lib/scholarsphere/client/version.rb,
lib/scholarsphere/client/collection.rb
Defined Under Namespace
Classes: Collection, Config, Error, Ingest, Upload
Constant Summary collapse
- VERSION =
'0.5.3'
Class Method Summary collapse
-
.api_key ⇒ String
Alphanumeric API key that grants access to the API.
-
.connection ⇒ Faraday::Connection
A cached connection to the Scholarsphere API with the provided credentials.
-
.reset ⇒ nil
Resets the client connection when needed.
-
.verify_ssl? ⇒ TrueClass, FalseClass
If set to 'false', Faraday will not verify the SSL certificate.
Class Method Details
.api_key ⇒ String
Returns Alphanumeric API key that grants access to the API.
44 45 46 |
# File 'lib/scholarsphere/client.rb', line 44 def api_key ENV.fetch('SS_CLIENT_KEY', nil) end |
.connection ⇒ Faraday::Connection
Returns A cached connection to the Scholarsphere API with the provided credentials.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scholarsphere/client.rb', line 21 def connection @connection ||= Faraday::Connection.new( url: ENV.fetch('SS4_ENDPOINT', nil), headers: { 'Content-Type' => 'application/json', 'X-API-KEY' => api_key }, ssl: { verify: verify_ssl? } ) end |
.reset ⇒ nil
Returns Resets the client connection when needed.
33 34 35 |
# File 'lib/scholarsphere/client.rb', line 33 def reset @connection = nil end |
.verify_ssl? ⇒ TrueClass, FalseClass
Returns If set to 'false', Faraday will not verify the SSL certificate. This is mostly used for testing. Default is 'true'.
39 40 41 |
# File 'lib/scholarsphere/client.rb', line 39 def verify_ssl? ENV['SS_CLIENT_SSL'] != 'false' end |