zenodo 0.0.3 → 0.0.6

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: 236ce200f114508da1156736e288271f971c0a74
4
- data.tar.gz: fd6304d31b4cc25eaa5f0febf096a4b26084350a
3
+ metadata.gz: 076dae0b2d6a7b61716e7d8a47dee8c03d9f0eec
4
+ data.tar.gz: 444a4c8a9f793930cb0d8dd77501d64cb498c8c0
5
5
  SHA512:
6
- metadata.gz: 8f4f78c788371a803033e0202123131875a29e3b68bc8a7fce2288c091d96f9e4b777aa66bafda73aef681137d0e5fff98c0908bf3518ab73095db10cbe081b9
7
- data.tar.gz: f9702240cd7ed30929ca6e22f64ff8965609cd285f8e6ac601d9912ec93973d0f50d1b1fa0b0461d853ca559df55f4ef7a2054fc341cf9c2938573c27c9824f7
6
+ metadata.gz: b0bf1bc1add5b02c77ba839091dd6a1715ba6e79854350d5a5b7f5c390ad7a43a01f5fe9417518531ebc654223a9ebb9d5b01982d9979d848561938a25ab36e9
7
+ data.tar.gz: 66204e3d312e07fbf534de48c3365bd1019d61d2dd9bb6afae7e1efe3a6123f2654050f22480afad57fd5eae90656b6bad25f378188d4b16a7ba06af6647bdcc
data/README.md CHANGED
@@ -84,7 +84,7 @@ Zenodo.client.delete_deposition(id: 1)
84
84
 
85
85
  ## Contributing
86
86
 
87
- 1. Fork it ( https://github.com/[my-github-username]/zenodo/fork )
87
+ 1. Fork it ( https://github.com/sprotocols/zenodo/fork )
88
88
  2. Create your feature branch (`git checkout -b my-new-feature`)
89
89
  3. Commit your changes (`git commit -am 'Add some feature'`)
90
90
  4. Push to the branch (`git push origin my-new-feature`)
@@ -16,16 +16,18 @@ module Zenodo
16
16
  # Upload a new file.
17
17
  # Note the upload will fail if the filename already exists.
18
18
  # @param [String, Fixnum] id A deposition's ID.
19
- # @param [String] file The file to upload.
20
- # @param [String] filename The name of the file (optional).
21
- # @raise [ArgumentError] If the method arguments are blank.
19
+ # @param [String] file_or_io The file or already open IO to upload.
20
+ # @param [String] filename The name of the file (optional except when an IO).
21
+ # @param [String] content_type The content type of the file (optional except when an IO).
22
+ # @raise [ArgumentError] If the required method arguments are blank.
22
23
  # @return [Zenodo::Resources::DepositionFile].
23
- def create_deposition_file(id:, file:, filename: '')
24
+ def create_deposition_file(id:, file_or_io:, filename: nil, content_type: nil)
24
25
  raise ArgumentError, "ID cannot be blank" if id.blank?
25
- raise ArgumentError, "File cannot be blank" if file.blank?
26
- content_type = MIME::Types.type_for(file).first.content_type
27
- io = Faraday::UploadIO.new(file, content_type)
28
- filename = File.basename(file) if filename.blank?
26
+ raise ArgumentError, "File or IO cannot be blank" if file_or_io.blank?
27
+
28
+ content_type = MIME::Types.type_for(file_or_io).first.content_type if content_type.blank?
29
+ io = Faraday::UploadIO.new(file_or_io, content_type, filename)
30
+ filename = File.basename(file_or_io) if filename.blank?
29
31
  Resources::DepositionFile.parse(
30
32
  request(:post, "deposit/depositions/#{id}/files", { name: filename, file: io },
31
33
  "Content-Type" => "multipart/form-data")
@@ -1,3 +1,3 @@
1
1
  module Zenodo
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -21,7 +21,7 @@ describe Zenodo::DSL::DepositionActions do
21
21
  let!(:deposition_file_id) do
22
22
  VCR.use_cassette('create_deposition_file_for_publishing') do
23
23
  deposition_file = Zenodo.client.create_deposition_file(
24
- id: deposition_id, file: file)
24
+ id: deposition_id, file_or_io: file)
25
25
  deposition_file['id']
26
26
  end
27
27
  end
@@ -27,14 +27,14 @@ describe Zenodo::DSL::DepositionFiles do
27
27
  let!(:deposition_file_id) do
28
28
  VCR.use_cassette('create_deposition_file') do
29
29
  deposition_file = Zenodo.client.create_deposition_file(
30
- id: deposition_id, file: file)
30
+ id: deposition_id, file_or_io: file)
31
31
  deposition_file['id']
32
32
  end
33
33
  end
34
34
  let!(:deleted_deposition_file_id) do
35
35
  VCR.use_cassette('create_deposition_file_for_deletion') do
36
36
  deposition_file = Zenodo.client.create_deposition_file(
37
- id: deposition_id, file: file_delete, filename: 'foobar.txt')
37
+ id: deposition_id, file_or_io: file_delete, filename: 'foobar.txt')
38
38
  deposition_file['id']
39
39
  end
40
40
  end
@@ -57,7 +57,7 @@ describe Zenodo::DSL::DepositionFiles do
57
57
  describe '#create_deposition_file' do
58
58
  it 'uploads a file for a deposition' do
59
59
  VCR.use_cassette('create_deposition_file') do
60
- deposition_file = Zenodo.client.create_deposition_file(id: deposition_id, file: file)
60
+ deposition_file = Zenodo.client.create_deposition_file(id: deposition_id, file_or_io: file)
61
61
  expect(deposition_file).to be_a(DepositionFile)
62
62
  end
63
63
  end
@@ -8,8 +8,13 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Zenodo::VERSION
9
9
  spec.authors = ["David Iorns"]
10
10
  spec.email = ["david.iorns@gmail.com"]
11
- spec.summary = 'A Ruby wrapper for the Zenodo API.'
12
- spec.homepage = ""
11
+ spec.summary = 'A Ruby wrapper for the Zenodo API. https://zenodo.org/dev'
12
+ spec.description = "A Ruby wrapper for the Zenodo API. https://zenodo.org/dev.
13
+
14
+ ZENODO builds and operates a simple and innovative service that enables researchers, scientists,
15
+ EU projects and institutions to share and showcase multidisciplinary research results (data and publications)
16
+ that are not part of the existing institutional or subject-based repositories of the research communities."
17
+ spec.homepage = "https://github.com/sprotocols/zenodo"
13
18
  spec.license = "MIT"
14
19
 
15
20
  spec.files = `git ls-files -z`.split("\x0")
@@ -17,13 +22,15 @@ Gem::Specification.new do |spec|
17
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
23
  spec.require_paths = ["lib"]
19
24
 
20
- spec.add_dependency 'faraday'
21
- spec.add_dependency 'activesupport'
22
- spec.add_dependency 'mime-types'
25
+ spec.required_ruby_version = '>= 2.0.0'
26
+
27
+ spec.add_dependency 'faraday', '~> 0.9'
28
+ spec.add_dependency 'activesupport', '~> 4.1'
29
+ spec.add_dependency 'mime-types', '~> 1.2'
23
30
 
24
31
  spec.add_development_dependency 'bundler', '~> 1.7'
25
32
  spec.add_development_dependency 'rake', '~> 10.0'
26
- spec.add_development_dependency 'rspec', '~> 3.0.0'
27
- spec.add_development_dependency 'webmock', '~> 1.18.0'
28
- spec.add_development_dependency 'vcr'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'webmock', '~> 1.18'
35
+ spec.add_development_dependency 'vcr', '~> 2.9'
29
36
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenodo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.6
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-12-28 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '4.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '4.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mime-types
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,43 +86,48 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.0.0
89
+ version: '3.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.0.0
96
+ version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.18.0
103
+ version: '1.18'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.18.0
110
+ version: '1.18'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: vcr
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '2.9'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
125
- description:
124
+ version: '2.9'
125
+ description: |-
126
+ A Ruby wrapper for the Zenodo API. https://zenodo.org/dev.
127
+
128
+ ZENODO builds and operates a simple and innovative service that enables researchers, scientists,
129
+ EU projects and institutions to share and showcase multidisciplinary research results (data and publications)
130
+ that are not part of the existing institutional or subject-based repositories of the research communities.
126
131
  email:
127
132
  - david.iorns@gmail.com
128
133
  executables: []
@@ -161,7 +166,7 @@ files:
161
166
  - spec/zenodo/dsl/deposition_files_spec.rb
162
167
  - spec/zenodo/dsl/depositions_spec.rb
163
168
  - zenodo.gemspec
164
- homepage: ''
169
+ homepage: https://github.com/sprotocols/zenodo
165
170
  licenses:
166
171
  - MIT
167
172
  metadata: {}
@@ -173,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
178
  requirements:
174
179
  - - ">="
175
180
  - !ruby/object:Gem::Version
176
- version: '0'
181
+ version: 2.0.0
177
182
  required_rubygems_version: !ruby/object:Gem::Requirement
178
183
  requirements:
179
184
  - - ">="
@@ -184,7 +189,7 @@ rubyforge_project:
184
189
  rubygems_version: 2.4.4
185
190
  signing_key:
186
191
  specification_version: 4
187
- summary: A Ruby wrapper for the Zenodo API.
192
+ summary: A Ruby wrapper for the Zenodo API. https://zenodo.org/dev
188
193
  test_files:
189
194
  - spec/fixtures/test_file_upload.txt
190
195
  - spec/fixtures/test_file_upload_delete.txt