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 CHANGED
@@ -1,2 +1,6 @@
1
+ h3. 0.5.1
2
+ * symbolize keys that are passed as config options
3
+
1
4
  h3. 0.5.0
2
5
  * added checksum validation
6
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -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]
@@ -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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Beer