diff --git a/VERSION b/VERSION index a3df0a6..ac39a10 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.0 +0.9.0 diff --git a/lib/ezid/client.rb b/lib/ezid/client.rb index 9ebbd96..8ab8bd9 100644 --- a/lib/ezid/client.rb +++ b/lib/ezid/client.rb @@ -17,6 +17,12 @@ module Ezid # class Client + # ezid-client gem version (e.g., "0.8.0") + VERSION = File.read(File.expand_path("../../../VERSION", __FILE__)).chomp + + # EZID API version + API_VERSION = "2" + class << self # Configuration reader def config @@ -28,6 +34,12 @@ def config def configure yield config end + + # Verbose version string + # @return [String] the version + def version + "ezid-client #{VERSION} (EZID API Version #{API_VERSION})" + end end attr_reader :session, :user, :password, :host, :use_ssl diff --git a/lib/ezid/configuration.rb b/lib/ezid/configuration.rb index 8e29891..ddcbb25 100644 --- a/lib/ezid/configuration.rb +++ b/lib/ezid/configuration.rb @@ -4,19 +4,22 @@ module Ezid # # EZID client configuration. # - # Use Ezid::Client.configure to set values. + # Use `Ezid::Client.configure` to set values. # # @api private + # class Configuration HOST = "ezid.cdlib.org" # EZID host name - # Default: "ezid.cdlib.org" + # Default: value of `EZID_HOST` environment variable, if present, or + # the EZID service host "ezid.cdlib.org". attr_accessor :host # Use HTTPS? - # Default: `true` + # Default: `true`, unless `EZID_USE_SSL` environment variable is set + # to the string "false". attr_accessor :use_ssl # EZID user name @@ -31,16 +34,6 @@ class Configuration # Default device: STDERR attr_writer :logger - # Default metadata profile - "erc" (EZID default), "dc", "datacite", or "crossref" - # If set, new identifiers (created or minted) will set the "_profile" element to - # this value. - # attr_accessor :default_metadata_profile - - # Default status - "public" (EZID default), "reserved", or "unavailable" - # If set, new identifiers (created or minted) will set the "_status" element to - # this value. - # attr_accessor :default_status - # Default shoulder for minting (scheme + NAAN + shoulder) # @example "ark:/99999/fk4" attr_accessor :default_shoulder diff --git a/lib/ezid/request.rb b/lib/ezid/request.rb index fb7b612..5745532 100644 --- a/lib/ezid/request.rb +++ b/lib/ezid/request.rb @@ -20,8 +20,8 @@ def self.execute(*args) end # @param method [Symbol] the Net::HTTP constant for the request method - # @param uri [URI] the uri - def initialize(method, uri) # path) + # @param uri [URI] the uri + def initialize(method, uri) http_method = Net::HTTP.const_get(method) super(http_method.new(uri)) set_content_type(CONTENT_TYPE, charset: CHARSET) diff --git a/lib/ezid/test_helper.rb b/lib/ezid/test_helper.rb index 8f316ff..399089e 100644 --- a/lib/ezid/test_helper.rb +++ b/lib/ezid/test_helper.rb @@ -5,18 +5,19 @@ module TestHelper TEST_ARK_SHOULDER = "ark:/99999/fk4" TEST_DOI_SHOULDER = "doi:10.5072/FK2" + TEST_USER = "apitest" TEST_HOST = Configuration::HOST + TEST_SHOULDER = TEST_ARK_SHOULDER def ezid_test_mode! Ezid::Client.configure do |config| - config.user = TEST_USER - # Contact EZID for password, or use your own user name and password - # config.password = "********" - config.host = TEST_HOST - config.use_ssl = true - config.logger = Logger.new(File::NULL) - config.default_shoulder = TEST_ARK_SHOULDER + config.user = ENV["EZID_TEST_USER"] || TEST_USER + config.password = ENV["EZID_TEST_PASSWORD"] + config.host = ENV["EZID_TEST_HOST"] || TEST_HOST + config.use_ssl = true + config.logger = Logger.new(File::NULL) + config.default_shoulder = ENV["EZID_TEST_SHOULDER"] || TEST_SHOULDER end end