rubydora 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.textile +4 -0
- data/VERSION +1 -1
- data/lib/rubydora/repository.rb +3 -1
- data/lib/rubydora/rest_api_client.rb +4 -0
- data/spec/lib/repository_spec.rb +7 -0
- metadata +3 -3
data/History.textile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/lib/rubydora/repository.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
2
|
+
|
1
3
|
module Rubydora
|
2
4
|
# Fedora Repository object that provides API access
|
3
5
|
class Repository
|
@@ -13,7 +15,7 @@ module Rubydora
|
|
13
15
|
# @option options [String] :password
|
14
16
|
# @option options [Boolean] :validateChecksum
|
15
17
|
def initialize options = {}
|
16
|
-
@config = options
|
18
|
+
@config = options.symbolize_keys
|
17
19
|
load_api_abstraction
|
18
20
|
end
|
19
21
|
|
@@ -12,8 +12,12 @@ module Rubydora
|
|
12
12
|
# @option config [String] :user
|
13
13
|
# @option config [String] :password
|
14
14
|
# @return [RestClient::Resource]
|
15
|
+
|
16
|
+
|
17
|
+
#TODO trap for these errors specifically: RestClient::Request::Unauthorized, Errno::ECONNREFUSED
|
15
18
|
def client config = {}
|
16
19
|
client_config = self.config.merge(config)
|
20
|
+
client_config.symbolize_keys!
|
17
21
|
if config.empty? or @config_hash.nil? or (client_config.hash == @config_hash)
|
18
22
|
@config_hash = client_config.hash
|
19
23
|
url = client_config[:url]
|
data/spec/lib/repository_spec.rb
CHANGED
@@ -5,6 +5,13 @@ describe Rubydora::Repository do
|
|
5
5
|
@repository = Rubydora::Repository.new
|
6
6
|
end
|
7
7
|
|
8
|
+
describe "initialize" do
|
9
|
+
it "should symbolize config keys" do
|
10
|
+
repository = Rubydora::Repository.new "validateChecksum"=> true
|
11
|
+
repository.config[:validateChecksum].should be_true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
describe "client" do
|
9
16
|
it "should return a RestClient resource" do
|
10
17
|
client = @repository.client
|
metadata
CHANGED