zenodo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 760bbc73a127edd08e6a2d032397e17926e56763
4
- data.tar.gz: dfda00d95a5a1eba199f094968903ad76e468bb3
3
+ metadata.gz: 236ce200f114508da1156736e288271f971c0a74
4
+ data.tar.gz: fd6304d31b4cc25eaa5f0febf096a4b26084350a
5
5
  SHA512:
6
- metadata.gz: 5f86205fdf020b77ee74fd7ade072c3ad7f24d95918daf83439984045cefaa3de92d15ef302ee3bec3d3ef3725a07c746337fa5f2eefe5fae06b65fab8f4333f
7
- data.tar.gz: 1af5d9ada62fb6f04e70d36ea57aa97c28d006eef252038701aee39a821a12f1d20c8ce5242552cfe238ecb919c395f65ef8d03941f0975ee1a2d0ff5f8c0072
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].
@@ -1,3 +1,3 @@
1
1
  module Zenodo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
- # let!(:deleted_deposition_file_id) do
34
- # VCR.use_cassette('create_deposition_file_for_deletion') do
35
- # deposition_file = Zenodo.client.create_deposition_file(
36
- # id: deposition_id, file: file, filename: 'foobar.txt')
37
- # deposition_file['id']
38
- # end
39
- # end
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
- # describe '#get_deposition_files' do
43
- # it 'returns a array of files for a deposition' do
44
- # VCR.use_cassette('get_deposition_files') do
45
- # deposition_files = Zenodo.client.get_deposition_files(id: deposition_id)
46
- # expect(deposition_files).to be_a(Array)
47
- # expect(deposition_files.first).to be_a(DepositionFile)
48
- # end
49
- # end
50
- # end
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
- # # Sort PUT deposit/depositions/:id/files
63
- # describe '#sort_deposition_files' do
64
- # it 'sorts files for a deposition' do
65
- # # VCR.use_cassette('sort_deposition_files') do
66
- # # deposition_files = Zenodo.client.sort_deposition_files(
67
- # # id: deposition_id, deposition_files: deposition_file_attributes)
68
- # # expect(deposition_files).to be_a(Array)
69
- # # expect(deposition_files.first).to be_a(DepositionFile)
70
- # # end
71
- # end
72
- # end
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
- # # Update PUT deposit/depositions/:id/files/:file_id
85
- # describe '#update_deposition_file' do
86
- # it 'updates a deposition file' do
87
- # # VCR.use_cassette('update_deposition_file') do
88
- # # deposition_file = Zenodo.client.update_deposition_file(
89
- # # id: deposition_id, deposition_file_id: deposition_file_id,
90
- # # deposition_file: deposition_file_attributes)
91
- # # expect(deposition_file).to be_a(DepositionFile)
92
- # # end
93
- # end
94
- # end
95
- #
96
- # # Delete DELETE deposit/depositions/:id/files/:file_id
97
- # describe '#delete_deposition_file' do
98
- # it 'returns a response with code 204' do
99
- # VCR.use_cassette('delete_deposition_file') do
100
- # response = Zenodo.client.delete_deposition_file(id: deposition_id, deposition_file_id: deleted_deposition_file_id)
101
- # expect(response.status).to eq(204)
102
- # end
103
- # end
104
- # end
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.2
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-16 00:00:00.000000000 Z
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