zenodo 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 236ce200f114508da1156736e288271f971c0a74
|
4
|
+
data.tar.gz: fd6304d31b4cc25eaa5f0febf096a4b26084350a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f4f78c788371a803033e0202123131875a29e3b68bc8a7fce2288c091d96f9e4b777aa66bafda73aef681137d0e5fff98c0908bf3518ab73095db10cbe081b9
|
7
|
+
data.tar.gz: f9702240cd7ed30929ca6e22f64ff8965609cd285f8e6ac601d9912ec93973d0f50d1b1fa0b0461d853ca559df55f4ef7a2054fc341cf9c2938573c27c9824f7
|
@@ -4,6 +4,7 @@ module Zenodo
|
|
4
4
|
module DSL::DepositionActions
|
5
5
|
# Publish POST deposit/depositions/:id/actions/publish
|
6
6
|
# Publishes a deposition.
|
7
|
+
# Note publishing will fail if no files are associated with the deposition.
|
7
8
|
# @param [String, Fixnum] id A deposition's ID.
|
8
9
|
# @raise [ArgumentError] If the method arguments are blank.
|
9
10
|
# @return [Zenodo::Resources::deposition, nil].
|
data/lib/zenodo/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Hello world
|
@@ -11,12 +11,20 @@ describe Zenodo::DSL::DepositionActions do
|
|
11
11
|
}
|
12
12
|
}
|
13
13
|
end
|
14
|
+
let!(:file) { File.join(APP_ROOT, 'spec/fixtures/test_file_upload.txt') }
|
14
15
|
let!(:deposition_id) do
|
15
16
|
VCR.use_cassette('create_deposition_for_publishing') do
|
16
17
|
deposition = Zenodo.client.create_deposition(deposition: deposition_attributes)
|
17
18
|
deposition['id']
|
18
19
|
end
|
19
20
|
end
|
21
|
+
let!(:deposition_file_id) do
|
22
|
+
VCR.use_cassette('create_deposition_file_for_publishing') do
|
23
|
+
deposition_file = Zenodo.client.create_deposition_file(
|
24
|
+
id: deposition_id, file: file)
|
25
|
+
deposition_file['id']
|
26
|
+
end
|
27
|
+
end
|
20
28
|
|
21
29
|
# Publish POST deposit/depositions/:id/actions/publish
|
22
30
|
describe '#publish_deposition' do
|
@@ -17,6 +17,7 @@ describe Zenodo::DSL::DepositionFiles do
|
|
17
17
|
}
|
18
18
|
end
|
19
19
|
let!(:file) { File.join(APP_ROOT, 'spec/fixtures/test_file_upload.txt') }
|
20
|
+
let!(:file_delete) { File.join(APP_ROOT, 'spec/fixtures/test_file_upload_delete.txt') }
|
20
21
|
let!(:deposition_id) do
|
21
22
|
VCR.use_cassette('create_deposition_with_files') do
|
22
23
|
deposition = Zenodo.client.create_deposition(deposition: deposition_attributes)
|
@@ -30,24 +31,27 @@ describe Zenodo::DSL::DepositionFiles do
|
|
30
31
|
deposition_file['id']
|
31
32
|
end
|
32
33
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
let!(:deleted_deposition_file_id) do
|
35
|
+
VCR.use_cassette('create_deposition_file_for_deletion') do
|
36
|
+
deposition_file = Zenodo.client.create_deposition_file(
|
37
|
+
id: deposition_id, file: file_delete, filename: 'foobar.txt')
|
38
|
+
deposition_file['id']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
let!(:deposition_files_array_for_sort) do
|
42
|
+
[{'id' => deposition_file_id}]
|
43
|
+
end
|
40
44
|
|
41
45
|
# List GET deposit/depositions/:id/files
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
describe '#get_deposition_files' do
|
47
|
+
it 'returns a array of files for a deposition' do
|
48
|
+
VCR.use_cassette('get_deposition_files') do
|
49
|
+
deposition_files = Zenodo.client.get_deposition_files(id: deposition_id)
|
50
|
+
expect(deposition_files).to be_a(Array)
|
51
|
+
expect(deposition_files.first).to be_a(DepositionFile)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
51
55
|
|
52
56
|
# Create (upload) POST deposit/depositions/:id/files
|
53
57
|
describe '#create_deposition_file' do
|
@@ -59,17 +63,17 @@ describe Zenodo::DSL::DepositionFiles do
|
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
62
|
-
#
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
# Sort PUT deposit/depositions/:id/files
|
67
|
+
describe '#sort_deposition_files' do
|
68
|
+
it 'sorts files for a deposition' do
|
69
|
+
VCR.use_cassette('sort_deposition_files') do
|
70
|
+
deposition_files = Zenodo.client.sort_deposition_files(
|
71
|
+
id: deposition_id, deposition_files: deposition_files_array_for_sort)
|
72
|
+
expect(deposition_files).to be_a(Array)
|
73
|
+
expect(deposition_files.first).to be_a(DepositionFile)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
73
77
|
|
74
78
|
# Retrieve GET deposit/depositions/:id/files/:file_id
|
75
79
|
describe '#get_deposition_file' do
|
@@ -81,25 +85,25 @@ describe Zenodo::DSL::DepositionFiles do
|
|
81
85
|
end
|
82
86
|
end
|
83
87
|
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
#
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
88
|
+
# Update PUT deposit/depositions/:id/files/:file_id
|
89
|
+
describe '#update_deposition_file' do
|
90
|
+
it 'updates a deposition file' do
|
91
|
+
VCR.use_cassette('update_deposition_file') do
|
92
|
+
deposition_file = Zenodo.client.update_deposition_file(
|
93
|
+
id: deposition_id, file_id: deposition_file_id,
|
94
|
+
deposition_file: deposition_file_attributes)
|
95
|
+
expect(deposition_file).to be_a(DepositionFile)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Delete DELETE deposit/depositions/:id/files/:file_id
|
101
|
+
describe '#delete_deposition_file' do
|
102
|
+
it 'returns a response with code 204' do
|
103
|
+
VCR.use_cassette('delete_deposition_file') do
|
104
|
+
response = Zenodo.client.delete_deposition_file(id: deposition_id, file_id: deleted_deposition_file_id)
|
105
|
+
expect(response.status).to eq(204)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
105
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zenodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Iorns
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/zenodo/utils/url_helper.rb
|
155
155
|
- lib/zenodo/version.rb
|
156
156
|
- spec/fixtures/test_file_upload.txt
|
157
|
+
- spec/fixtures/test_file_upload_delete.txt
|
157
158
|
- spec/spec_helper.rb
|
158
159
|
- spec/zenodo/client_spec.rb
|
159
160
|
- spec/zenodo/dsl/deposition_actions_spec.rb
|
@@ -186,6 +187,7 @@ specification_version: 4
|
|
186
187
|
summary: A Ruby wrapper for the Zenodo API.
|
187
188
|
test_files:
|
188
189
|
- spec/fixtures/test_file_upload.txt
|
190
|
+
- spec/fixtures/test_file_upload_delete.txt
|
189
191
|
- spec/spec_helper.rb
|
190
192
|
- spec/zenodo/client_spec.rb
|
191
193
|
- spec/zenodo/dsl/deposition_actions_spec.rb
|