ezid-client 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ezid/client.rb +12 -0
- data/lib/ezid/configuration.rb +6 -13
- data/lib/ezid/request.rb +2 -2
- data/lib/ezid/test_helper.rb +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d293bcff52ee5fc46ff4b072fd1593d09bc1518
|
4
|
+
data.tar.gz: 0b62eadf5c906ecfe85e1bf7caaf2d49a47dec56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1246ddbb77a2a3cfef82934dc7498ee6be3e57106974e71cb16c4e1f7e812929fe6e1ec67f35ad286ab0736264fffabfdc3f0e2dabe6c66839116920fadc4359
|
7
|
+
data.tar.gz: fb3a3ae2e4a1bc0bd065c4e6bccd2f10078abde0cd0ab7a3db56c6d39c9d1943a67a82961b67b16db6dc43e62c084774d268f9379dcdaed57dc7f7b9f2b7ddb5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/lib/ezid/client.rb
CHANGED
@@ -17,6 +17,12 @@ module Ezid
|
|
17
17
|
#
|
18
18
|
class Client
|
19
19
|
|
20
|
+
# ezid-client gem version (e.g., "0.8.0")
|
21
|
+
VERSION = File.read(File.expand_path("../../../VERSION", __FILE__)).chomp
|
22
|
+
|
23
|
+
# EZID API version
|
24
|
+
API_VERSION = "2"
|
25
|
+
|
20
26
|
class << self
|
21
27
|
# Configuration reader
|
22
28
|
def config
|
@@ -28,6 +34,12 @@ module Ezid
|
|
28
34
|
def configure
|
29
35
|
yield config
|
30
36
|
end
|
37
|
+
|
38
|
+
# Verbose version string
|
39
|
+
# @return [String] the version
|
40
|
+
def version
|
41
|
+
"ezid-client #{VERSION} (EZID API Version #{API_VERSION})"
|
42
|
+
end
|
31
43
|
end
|
32
44
|
|
33
45
|
attr_reader :session, :user, :password, :host, :use_ssl
|
data/lib/ezid/configuration.rb
CHANGED
@@ -4,19 +4,22 @@ module Ezid
|
|
4
4
|
#
|
5
5
|
# EZID client configuration.
|
6
6
|
#
|
7
|
-
# Use Ezid::Client.configure to set values.
|
7
|
+
# Use `Ezid::Client.configure` to set values.
|
8
8
|
#
|
9
9
|
# @api private
|
10
|
+
#
|
10
11
|
class Configuration
|
11
12
|
|
12
13
|
HOST = "ezid.cdlib.org"
|
13
14
|
|
14
15
|
# EZID host name
|
15
|
-
# Default:
|
16
|
+
# Default: value of `EZID_HOST` environment variable, if present, or
|
17
|
+
# the EZID service host "ezid.cdlib.org".
|
16
18
|
attr_accessor :host
|
17
19
|
|
18
20
|
# Use HTTPS?
|
19
|
-
# Default: `true`
|
21
|
+
# Default: `true`, unless `EZID_USE_SSL` environment variable is set
|
22
|
+
# to the string "false".
|
20
23
|
attr_accessor :use_ssl
|
21
24
|
|
22
25
|
# EZID user name
|
@@ -31,16 +34,6 @@ module Ezid
|
|
31
34
|
# Default device: STDERR
|
32
35
|
attr_writer :logger
|
33
36
|
|
34
|
-
# Default metadata profile - "erc" (EZID default), "dc", "datacite", or "crossref"
|
35
|
-
# If set, new identifiers (created or minted) will set the "_profile" element to
|
36
|
-
# this value.
|
37
|
-
# attr_accessor :default_metadata_profile
|
38
|
-
|
39
|
-
# Default status - "public" (EZID default), "reserved", or "unavailable"
|
40
|
-
# If set, new identifiers (created or minted) will set the "_status" element to
|
41
|
-
# this value.
|
42
|
-
# attr_accessor :default_status
|
43
|
-
|
44
37
|
# Default shoulder for minting (scheme + NAAN + shoulder)
|
45
38
|
# @example "ark:/99999/fk4"
|
46
39
|
attr_accessor :default_shoulder
|
data/lib/ezid/request.rb
CHANGED
@@ -20,8 +20,8 @@ module Ezid
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# @param method [Symbol] the Net::HTTP constant for the request method
|
23
|
-
# @param uri [URI] the uri
|
24
|
-
def initialize(method, uri)
|
23
|
+
# @param uri [URI] the uri
|
24
|
+
def initialize(method, uri)
|
25
25
|
http_method = Net::HTTP.const_get(method)
|
26
26
|
super(http_method.new(uri))
|
27
27
|
set_content_type(CONTENT_TYPE, charset: CHARSET)
|
data/lib/ezid/test_helper.rb
CHANGED
@@ -5,18 +5,19 @@ module Ezid
|
|
5
5
|
|
6
6
|
TEST_ARK_SHOULDER = "ark:/99999/fk4"
|
7
7
|
TEST_DOI_SHOULDER = "doi:10.5072/FK2"
|
8
|
+
|
8
9
|
TEST_USER = "apitest"
|
9
10
|
TEST_HOST = Configuration::HOST
|
11
|
+
TEST_SHOULDER = TEST_ARK_SHOULDER
|
10
12
|
|
11
13
|
def ezid_test_mode!
|
12
14
|
Ezid::Client.configure do |config|
|
13
|
-
config.user
|
14
|
-
|
15
|
-
|
16
|
-
config.
|
17
|
-
config.
|
18
|
-
config.
|
19
|
-
config.default_shoulder = TEST_ARK_SHOULDER
|
15
|
+
config.user = ENV["EZID_TEST_USER"] || TEST_USER
|
16
|
+
config.password = ENV["EZID_TEST_PASSWORD"]
|
17
|
+
config.host = ENV["EZID_TEST_HOST"] || TEST_HOST
|
18
|
+
config.use_ssl = true
|
19
|
+
config.logger = Logger.new(File::NULL)
|
20
|
+
config.default_shoulder = ENV["EZID_TEST_SHOULDER"] || TEST_SHOULDER
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezid-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chandek-Stark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|