rubydora 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +573 -0
- data/.travis.yml +6 -6
- data/Gemfile +2 -3
- data/README.md +86 -0
- data/Rakefile +22 -25
- data/VERSION +1 -1
- data/lib/rubydora.rb +3 -6
- data/lib/rubydora/array_with_callback.rb +4 -4
- data/lib/rubydora/audit_trail.rb +7 -7
- data/lib/rubydora/callbacks.rb +9 -9
- data/lib/rubydora/datastream.rb +43 -39
- data/lib/rubydora/digital_object.rb +31 -33
- data/lib/rubydora/fc3_service.rb +10 -14
- data/lib/rubydora/fedora_url_helpers.rb +21 -22
- data/lib/rubydora/models_mixin.rb +4 -4
- data/lib/rubydora/profile_parser.rb +8 -8
- data/lib/rubydora/relationships_mixin.rb +15 -16
- data/lib/rubydora/repository.rb +11 -11
- data/lib/rubydora/resource_index.rb +10 -14
- data/lib/rubydora/rest_api_client.rb +52 -53
- data/lib/rubydora/transactions.rb +42 -51
- data/rubydora.gemspec +25 -25
- data/spec/audit_trail_spec.rb +1 -1
- data/spec/lib/datastream_spec.rb +34 -32
- data/spec/lib/digital_object_spec.rb +13 -10
- data/spec/lib/integration_test_spec.rb +116 -119
- data/spec/lib/profile_parser_spec.rb +1 -1
- data/spec/lib/repository_spec.rb +5 -5
- data/spec/lib/rest_api_client_spec.rb +60 -66
- data/spec/lib/transactions_spec.rb +4 -6
- data/spec/spec_helper.rb +2 -9
- metadata +30 -31
- data/.gitmodules +0 -0
- data/README.rdoc +0 -79
- data/gemfiles/gemfile.rails3 +0 -11
- data/gemfiles/gemfile.rails4 +0 -10
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Rubydora::Transactions do
|
4
|
-
|
5
4
|
|
6
|
-
subject {
|
5
|
+
subject {
|
7
6
|
# Rubydora::Repository.any_instance.stub(:version).and_return(100)
|
8
7
|
# repository = Rubydora::Repository.new :url => 'http://example.org'
|
9
8
|
Rubydora::Fc3Service.new :url => 'http://example.org'
|
@@ -15,15 +14,14 @@ describe Rubydora::Transactions do
|
|
15
14
|
subject.client.stub_chain(:[], :put).and_return 'asdf'
|
16
15
|
subject.client.stub_chain(:[], :delete)
|
17
16
|
|
18
|
-
|
17
|
+
# this should be squelched
|
19
18
|
subject.should_not_receive(:export).with(hash_including(:pid => 'asdf', :context => :archive))
|
20
|
-
|
19
|
+
|
21
20
|
subject.transaction do |t|
|
22
21
|
subject.ingest :pid => 'asdf', :file => '<a />'
|
23
22
|
subject.purge_object :pid => 'asdf'
|
24
23
|
subject.modify_datastream :pid => 'asdf', :dsid => 'mydsid'
|
25
24
|
|
26
|
-
|
27
25
|
subject.should_receive(:purge_object).with(hash_including(:pid => 'asdf'))
|
28
26
|
|
29
27
|
# this should be squelched
|
@@ -71,7 +69,7 @@ describe Rubydora::Transactions do
|
|
71
69
|
subject.client.stub_chain(:[], :put).and_return 'asdf'
|
72
70
|
|
73
71
|
profile_xml = "<objectProfile><objState>A</objState><objOwnerId>567</objOwnerId></objectProfile>"
|
74
|
-
subject.should_receive(:object).with(pid: 'asdf').and_return profile_xml
|
72
|
+
subject.should_receive(:object).with(pid: 'asdf').and_return profile_xml
|
75
73
|
|
76
74
|
subject.transaction do |t|
|
77
75
|
subject.modify_object :pid => 'asdf', :state => 'I', :ownerId => '123', :logMessage => 'changing asdf'
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require 'simplecov'
|
7
|
-
require 'simplecov-rcov'
|
8
|
-
|
9
|
-
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
10
|
-
SimpleCov.start
|
11
|
-
end
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
12
6
|
|
13
7
|
require 'rspec/autorun'
|
14
8
|
require 'rubydora'
|
@@ -17,5 +11,4 @@ require 'webmock/rspec'
|
|
17
11
|
WebMock.allow_net_connect!
|
18
12
|
|
19
13
|
RSpec.configure do |config|
|
20
|
-
|
21
14
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubydora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: fastercsv
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rest-client
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +100,14 @@ dependencies:
|
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.3
|
103
|
+
version: '0.3'
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.3
|
110
|
+
version: '0.3'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: deprecation
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +136,20 @@ dependencies:
|
|
150
136
|
- - ">="
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: bundler
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,35 +179,35 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '2.0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: jettywrapper
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 1.4.0
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 1.4.0
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: webmock
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: '0'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
210
|
+
name: simplecov
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - ">="
|
@@ -228,19 +228,19 @@ extensions: []
|
|
228
228
|
extra_rdoc_files: []
|
229
229
|
files:
|
230
230
|
- ".gitignore"
|
231
|
-
- ".gitmodules"
|
232
231
|
- ".mailmap"
|
232
|
+
- ".rspec"
|
233
|
+
- ".rubocop.yml"
|
234
|
+
- ".rubocop_todo.yml"
|
233
235
|
- ".travis.yml"
|
234
236
|
- CONTRIBUTING.md
|
235
237
|
- Gemfile
|
236
238
|
- History.textile
|
237
239
|
- LICENSE.txt
|
238
240
|
- Notices.txt
|
239
|
-
- README.
|
241
|
+
- README.md
|
240
242
|
- Rakefile
|
241
243
|
- VERSION
|
242
|
-
- gemfiles/gemfile.rails3
|
243
|
-
- gemfiles/gemfile.rails4
|
244
244
|
- lib/rubydora.rb
|
245
245
|
- lib/rubydora/array_with_callback.rb
|
246
246
|
- lib/rubydora/audit_trail.rb
|
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
290
|
rubyforge_project:
|
291
|
-
rubygems_version: 2.
|
291
|
+
rubygems_version: 2.5.1
|
292
292
|
signing_key:
|
293
293
|
specification_version: 4
|
294
294
|
summary: Fedora Commons REST API ruby library
|
@@ -304,4 +304,3 @@ test_files:
|
|
304
304
|
- spec/lib/rest_api_client_spec.rb
|
305
305
|
- spec/lib/transactions_spec.rb
|
306
306
|
- spec/spec_helper.rb
|
307
|
-
has_rdoc:
|
data/.gitmodules
DELETED
File without changes
|
data/README.rdoc
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
= rubydora
|
2
|
-
{<img src="https://travis-ci.org/projecthydra/rubydora.png?branch=master" alt="Build Status" />}[https://travis-ci.org/projecthydra/rubydora]
|
3
|
-
{<img src="https://badge.fury.io/rb/rubydora.png" alt="Gem Version" />}[http://badge.fury.io/rb/rubydora]
|
4
|
-
|
5
|
-
Rubydora is a low-level Fedora Commons REST API consumer, providing direct access to REST API methods, as well as a primitive ruby abstraction.
|
6
|
-
|
7
|
-
== Installation
|
8
|
-
|
9
|
-
gem install rubydora
|
10
|
-
|
11
|
-
== Examples
|
12
|
-
|
13
|
-
> repo = Rubydora.connect :url => 'http://localhost:8983/fedora', :user => 'fedoraAdmin', :password => 'fedoraAdmin'
|
14
|
-
=> #<Rubydora::Repository:0x101859538 @config={:url=>"http://localhost:8983/fedora", :user=>"fedoraAdmin", :password=>"fedoraAdmin"}>
|
15
|
-
|
16
|
-
> obj = repo.find('test:1')
|
17
|
-
=> #<Rubydora::DigitalObject:0x101977230 @pid="test:1", @repository=#<Rubydora::Repository:0x1019beef0 @config={:user=>"fedoraAdmin", :url=>"http://localhost:8983/fedora", :password=>"fedora"}>>
|
18
|
-
|
19
|
-
> obj.new?
|
20
|
-
=> true
|
21
|
-
|
22
|
-
> obj = obj.save
|
23
|
-
=> #<Rubydora::DigitalObject:0x1017601b8 @pid="test:1", @repository=#<Rubydora::Repository:0x1018e3058 @config={:url=>"http://localhost:8983/fedora", :user=>"fedoraAdmin", :password=>"fedoraAdmin"}, @client=#<RestClient::Resource:0x101882910 @options={:user=>"fedoraAdmin", :password=>"fedoraAdmin"}, @block=nil, @url="http://localhost:8983/fedora">>>
|
24
|
-
|
25
|
-
> obj.profile
|
26
|
-
=> {"objDissIndexViewURL"=>"http://localhost:8983/fedora/get/test:1/fedora-system:3/viewMethodIndex", "objLabel"=>"", "objModels"=>"info:fedora/fedora-system:FedoraObject-3.0", "objCreateDate"=>"2011-04-18T13:34:11.285Z", "objOwnerId"=>"fedoraAdmin", "objState"=>"A", "objItemIndexViewURL"=>"http://localhost:8983/fedora/get/test:1/fedora-system:3/viewItemIndex", "objLastModDate"=>"2011-04-18T13:47:30.110Z"}
|
27
|
-
|
28
|
-
> obj.models
|
29
|
-
=> ["info:fedora/fedora-system:FedoraObject-3.0"]
|
30
|
-
|
31
|
-
> obj.models << 'info:fedora/test:cmodel'
|
32
|
-
=> ["info:fedora/fedora-system:FedoraObject-3.0", "info:fedora/test:cmodel"]
|
33
|
-
|
34
|
-
> obj2 = repo.find('test:2')
|
35
|
-
=> [...]
|
36
|
-
|
37
|
-
> obj1.parts << obj2
|
38
|
-
=> [...]
|
39
|
-
|
40
|
-
> obj.datastreams
|
41
|
-
=> {"DC"=>#<Rubydora::Datastream:0x101860180 @dsid="DC" ...> }
|
42
|
-
|
43
|
-
> ds = obj.datastreams['File']
|
44
|
-
=> #<Rubydora::Datastream:0x1017f26a8 @dsid="File" ...>
|
45
|
-
> ds.controlGroup = 'R'
|
46
|
-
=> "R"
|
47
|
-
> ds.dsLocation = 'http://example.org/index.html'
|
48
|
-
=> "http://example.org/index.html"
|
49
|
-
> ds.dsLabel = 'Example redirect datastream'
|
50
|
-
=> "Example redirect datastream"
|
51
|
-
> ds.mimeType = 'text/html'
|
52
|
-
=> "text/html"
|
53
|
-
> ds.save
|
54
|
-
=> #<Rubydora::Datastream:0x10177a568 @dsid="File" ...>
|
55
|
-
|
56
|
-
> obj.datastreams
|
57
|
-
=> {"DC"=>#<Rubydora::Datastream:0x101860180 @dsid="DC" ..., "File"=>#<Rubydora::Datastream:0x10177a568 @dsid="File" ...>}
|
58
|
-
|
59
|
-
> obj.datastreams["File"].delete
|
60
|
-
=> true
|
61
|
-
> obj.datastreams["File"].new?
|
62
|
-
=> true
|
63
|
-
|
64
|
-
|
65
|
-
== Contributing to rubydora
|
66
|
-
|
67
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
68
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
69
|
-
* Fork the project
|
70
|
-
* Start a feature/bugfix branch
|
71
|
-
* Commit and push until you are happy with your contribution
|
72
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
73
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
74
|
-
|
75
|
-
== Copyright
|
76
|
-
|
77
|
-
Copyright (c) 2011 Chris Beer. See LICENSE.txt for
|
78
|
-
further details.
|
79
|
-
|
data/gemfiles/gemfile.rails3
DELETED