Skip to content

Commit

Permalink
Merge branch 'release-0.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
dchandekstark committed Dec 17, 2014
2 parents e057fbc + 67f9681 commit e01dabf
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.0
0.9.0
12 changes: 12 additions & 0 deletions lib/ezid/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 6 additions & 13 deletions lib/ezid/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/ezid/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 8 additions & 7 deletions lib/ezid/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e01dabf

Please sign in to comment.