figshare_api_v2 0.9.2 → 0.9.6
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 +4 -4
- data/History.txt +50 -0
- data/lib/authors.rb +16 -13
- data/lib/base.rb +65 -65
- data/lib/figshare_api_v2.rb +19 -18
- data/lib/institutions.rb +82 -82
- data/lib/oai_pmh.rb +4 -2
- data/lib/other.rb +13 -13
- data/lib/private_articles.rb +159 -91
- data/lib/private_collections.rb +87 -84
- data/lib/private_projects.rb +79 -78
- data/lib/public_articles.rb +60 -51
- data/lib/public_collections.rb +50 -42
- data/lib/public_projects.rb +24 -23
- data/lib/upload.rb +53 -48
- metadata +8 -8
data/lib/private_projects.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Figshare
|
2
|
-
|
3
2
|
# Figshare private project api
|
4
3
|
#
|
5
4
|
class PrivateProjects < Base
|
@@ -13,11 +12,11 @@ module Figshare
|
|
13
12
|
# @yield [Hash] {role, storage, url, published_date, id, title}
|
14
13
|
def list(storage: nil, roles: nil, order: 'published_date', order_direction: 'desc', impersonate: nil, &block)
|
15
14
|
args = {}
|
16
|
-
args['storage'] = storage
|
17
|
-
args['roles'] = roles
|
18
|
-
args['order'] = order
|
19
|
-
args['order_direction'] = order_direction
|
20
|
-
args[
|
15
|
+
args['storage'] = storage unless storage.nil?
|
16
|
+
args['roles'] = roles unless roles.nil?
|
17
|
+
args['order'] = order unless order.nil?
|
18
|
+
args['order_direction'] = order_direction unless order_direction.nil?
|
19
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
21
20
|
get_paginate(api_query: 'account/projects', args: args, &block)
|
22
21
|
end
|
23
22
|
|
@@ -31,20 +30,24 @@ module Figshare
|
|
31
30
|
# @param order_direction [String] "desc" Default, "asc"
|
32
31
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
33
32
|
# @yield [Hash] {id, title, doi, handle, url, published_date}
|
34
|
-
def search(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
def search( search_for:,
|
34
|
+
institute: false,
|
35
|
+
group_id: nil,
|
36
|
+
impersonate: nil,
|
37
|
+
published_since: nil,
|
38
|
+
modified_since: nil,
|
39
|
+
order: 'published_date',
|
40
|
+
order_direction: 'desc',
|
41
|
+
&block
|
42
|
+
)
|
40
43
|
args = { 'search_for' => search_for }
|
41
|
-
args['institution'] = @institute_id
|
42
|
-
args['group'] = group_id
|
43
|
-
args[
|
44
|
-
args['published_since'] = published_since
|
45
|
-
args['modified_since'] = modified_since
|
46
|
-
args['order'] = order
|
47
|
-
args['order_direction'] = order_direction
|
44
|
+
args['institution'] = @institute_id unless institute.nil?
|
45
|
+
args['group'] = group_id unless group_id.nil?
|
46
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
47
|
+
args['published_since'] = published_since unless published_since.nil?
|
48
|
+
args['modified_since'] = modified_since unless modified_since.nil?
|
49
|
+
args['order'] = order unless order.nil?
|
50
|
+
args['order_direction'] = order_direction unless order_direction.nil?
|
48
51
|
post(api_query: 'account/projects/search', args: args, &block)
|
49
52
|
end
|
50
53
|
|
@@ -57,27 +60,27 @@ module Figshare
|
|
57
60
|
# #param group_id [Integer] Figshare group the project falls under.
|
58
61
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
59
62
|
# @yield [Hash] { location }
|
60
|
-
def create(title:, description:, funding: '', funding_list: [],
|
61
|
-
args = {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
def create(title:, description:, group_id:, funding: '', funding_list: [], impersonate: nil, &block)
|
64
|
+
args = { 'title' => title,
|
65
|
+
'description' => description,
|
66
|
+
'group_id' => group_id,
|
67
|
+
'funding' => funding,
|
68
|
+
'funding_list' => funding_list
|
66
69
|
}
|
67
|
-
args[
|
70
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
68
71
|
post(api_query: 'account/projects', args: args, &block)
|
69
72
|
end
|
70
|
-
|
73
|
+
|
71
74
|
# Delete an existing project
|
72
75
|
#
|
73
76
|
# @param project_id [Integer] Figshare project ID
|
74
77
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
75
78
|
def project_delete(project_id:, impersonate: nil, &block)
|
76
79
|
args = {}
|
77
|
-
args[
|
78
|
-
delete(api_query:
|
80
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
81
|
+
delete(api_query: "account/projects/#{project_id}", args: args, &block)
|
79
82
|
end
|
80
|
-
|
83
|
+
|
81
84
|
# Return details of specific private project
|
82
85
|
#
|
83
86
|
# @param project_id [Integer] Figshare id of the project_id
|
@@ -85,8 +88,8 @@ module Figshare
|
|
85
88
|
# @yield [Hash] See figshare api docs
|
86
89
|
def detail(project_id:, impersonate: nil, &block)
|
87
90
|
args = {}
|
88
|
-
args[
|
89
|
-
get(api_query: "account/projects/#{project_id}",
|
91
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
92
|
+
get(api_query: "account/projects/#{project_id}", args: args, &block)
|
90
93
|
end
|
91
94
|
|
92
95
|
# Update an existing project
|
@@ -100,14 +103,14 @@ module Figshare
|
|
100
103
|
# @yield [Hash] { location }
|
101
104
|
def update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, impersonate: nil, &block)
|
102
105
|
args = {}
|
103
|
-
args[
|
104
|
-
args[
|
105
|
-
args[
|
106
|
-
args[
|
107
|
-
args[
|
106
|
+
args['title'] = title unless title.nil?
|
107
|
+
args['description'] = description unless description.nil?
|
108
|
+
args['funding'] = funding unless funding.nil?
|
109
|
+
args['funding_list'] = funding_list unless funding_list.nil?
|
110
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
108
111
|
put(api_query: "account/projects/#{project_id}", args: args, &block)
|
109
112
|
end
|
110
|
-
|
113
|
+
|
111
114
|
# Publish a project
|
112
115
|
#
|
113
116
|
# @param project_id [Integer] Figshare id of the project
|
@@ -115,10 +118,10 @@ module Figshare
|
|
115
118
|
# @yield [Hash] Message
|
116
119
|
def publish(project_id:, impersonate: nil, &block)
|
117
120
|
args = {}
|
118
|
-
args[
|
121
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
119
122
|
post(api_query: "account/projects/#{project_id}/publish", args: args, &block)
|
120
123
|
end
|
121
|
-
|
124
|
+
|
122
125
|
# List projects notes
|
123
126
|
#
|
124
127
|
# @param project_id [Integer] Figshare id of the project
|
@@ -126,10 +129,10 @@ module Figshare
|
|
126
129
|
# @yield [Hash] {id, user_id, abstract, user_name, created_date, modified_date}
|
127
130
|
def notes(project_id:, impersonate: nil, &block)
|
128
131
|
args = {}
|
129
|
-
args[
|
132
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
130
133
|
get_paginate(api_query: "account/projects/#{project_id}/notes", args: args, &block)
|
131
134
|
end
|
132
|
-
|
135
|
+
|
133
136
|
# Create a project note
|
134
137
|
#
|
135
138
|
# @param project_id [Integer] Figshare id of the project
|
@@ -138,10 +141,10 @@ module Figshare
|
|
138
141
|
# @yield [Hash] { location }
|
139
142
|
def note_create(project_id:, text:, impersonate: nil, &block)
|
140
143
|
args = { 'text' => text }
|
141
|
-
args[
|
144
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
142
145
|
post(api_query: "account/projects/#{project_id}/notes", args: args, &block)
|
143
146
|
end
|
144
|
-
|
147
|
+
|
145
148
|
# Delete a project note
|
146
149
|
#
|
147
150
|
# @param project_id [Integer] Figshare id of the project
|
@@ -149,10 +152,10 @@ module Figshare
|
|
149
152
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
150
153
|
def note_delete(project_id:, note_id:, impersonate: nil, &block)
|
151
154
|
args = {}
|
152
|
-
args[
|
155
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
153
156
|
delete(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block)
|
154
157
|
end
|
155
|
-
|
158
|
+
|
156
159
|
# Get a note's text
|
157
160
|
#
|
158
161
|
# @param project_id [Integer] Figshare id of the project
|
@@ -161,31 +164,31 @@ module Figshare
|
|
161
164
|
# @yield [Hash] { text }
|
162
165
|
def note_detail(impersonate: nil, &block)
|
163
166
|
args = {}
|
164
|
-
args[
|
167
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
165
168
|
get(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block)
|
166
169
|
end
|
167
|
-
|
170
|
+
|
168
171
|
# update a project note
|
169
172
|
#
|
170
173
|
# @param project_id [Integer] Figshare id of the project
|
171
174
|
# @param note_id [Integer] Figshare id of the note
|
172
175
|
# @param text [String] The note
|
173
176
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
174
|
-
def
|
177
|
+
def note_update(project_id:, note_id:, text:, impersonate: nil, &block)
|
175
178
|
args = { 'text' => text }
|
176
|
-
args[
|
179
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
177
180
|
put(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block)
|
178
181
|
end
|
179
|
-
|
182
|
+
|
180
183
|
# Leave a project (Please note: project's owner cannot leave the project.)
|
181
184
|
#
|
182
185
|
# @param project_id [Integer] Figshare id of the project_id
|
183
186
|
def private_project_collaborators_leave(project_id:, impersonate: nil, &block)
|
184
187
|
args = {}
|
185
|
-
args[
|
188
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
186
189
|
post(api_query: "account/projects/#{project_id}/leave", args: args, &block)
|
187
190
|
end
|
188
|
-
|
191
|
+
|
189
192
|
# Get the project collaborators
|
190
193
|
#
|
191
194
|
# @param project_id [Integer] Figshare id of the project_id
|
@@ -193,10 +196,10 @@ module Figshare
|
|
193
196
|
# @yield [Hash] { status, role_name, user_id, name }
|
194
197
|
def collaborators(project_id:, impersonate: nil, &block)
|
195
198
|
args = {}
|
196
|
-
args[
|
199
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
197
200
|
get(api_query: "account/projects/#{project_id}/collaborators", args: args, &block)
|
198
201
|
end
|
199
|
-
|
202
|
+
|
200
203
|
# Invite a new collaborators to the project
|
201
204
|
#
|
202
205
|
# @param project_id [Integer] Figshare id of the project_id
|
@@ -205,7 +208,7 @@ module Figshare
|
|
205
208
|
# @param email [String] Used, if user_id is nil
|
206
209
|
# @param comment [String]
|
207
210
|
# @yield [String] { message }
|
208
|
-
def collaborator_invite(project_id:, role_name:, user_id: nil, email: nil,
|
211
|
+
def collaborator_invite(project_id:, role_name:, comment:, user_id: nil, email: nil, impersonate: nil, &block)
|
209
212
|
args = {
|
210
213
|
'role_name' => role_name,
|
211
214
|
'comment' => comment
|
@@ -215,13 +218,13 @@ module Figshare
|
|
215
218
|
elsif ! email.nil?
|
216
219
|
args['email'] = email
|
217
220
|
else
|
218
|
-
raise
|
221
|
+
raise 'collaborator_invite(): Need a user_id or an email address'
|
219
222
|
end
|
220
|
-
args[
|
221
|
-
collaborator = {
|
223
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
224
|
+
collaborator = { 'role_name' => role_name, 'user_id' => user_id, 'email' => email, 'comment' => comment }
|
222
225
|
post(api_query: "account/project/#{project_id}/collaborators", args: args, data: collaborator, &block)
|
223
226
|
end
|
224
|
-
|
227
|
+
|
225
228
|
# Leave a project (Please note: project's owner cannot leave the project.)
|
226
229
|
#
|
227
230
|
# @param project_id [Integer] Figshare id of the project_id
|
@@ -229,10 +232,10 @@ module Figshare
|
|
229
232
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
230
233
|
def collaborator_remove(project_id:, user_id:, impersonate: nil, &block)
|
231
234
|
args = {}
|
232
|
-
args[
|
235
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
233
236
|
delete(api_query: "account/project/#{project_id}/collaborators/#{user_id}", args: args, &block)
|
234
237
|
end
|
235
|
-
|
238
|
+
|
236
239
|
# Return details of list of articles for a specific project
|
237
240
|
#
|
238
241
|
# @param project_id [Integer] Figshare id of the project
|
@@ -240,23 +243,22 @@ module Figshare
|
|
240
243
|
# @yield [Hash] See Figshare API Doc
|
241
244
|
def articles(project_id:, impersonate: nil, &block)
|
242
245
|
args = {}
|
243
|
-
args[
|
246
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
244
247
|
get_paginate(api_query: "account/projects/#{project_id}/articles", args: args, &block)
|
245
248
|
end
|
246
|
-
|
249
|
+
|
247
250
|
# Create a new Article and associate it with this project
|
248
251
|
#
|
249
252
|
# @param project_id [Integer] Figshare id of the project
|
250
|
-
# @param article [Hash] See figshare API docs
|
251
253
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
252
254
|
# @yield [Hash] { location }
|
253
|
-
def article_create(project_id:,
|
255
|
+
def article_create(project_id:, impersonate: nil, &block)
|
254
256
|
args = {}
|
255
|
-
args[
|
257
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
256
258
|
# Figshare Docs say this should be post_paginate, but that makes no sense. Will have to test
|
257
259
|
post_paginate(api_query: "account/projects/#{project_id}/articles", args: args, &block)
|
258
260
|
end
|
259
|
-
|
261
|
+
|
260
262
|
# delete an article from a project
|
261
263
|
#
|
262
264
|
# @param project_id [Integer] Figshare id of the project
|
@@ -264,10 +266,10 @@ module Figshare
|
|
264
266
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
265
267
|
def article_delete(project_id:, article_id:, impersonate: nil, &block)
|
266
268
|
args = {}
|
267
|
-
args[
|
269
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
268
270
|
delete(api_query: "account/projects/#{project_id}/articles/#{article_id}", args: args, &block)
|
269
271
|
end
|
270
|
-
|
272
|
+
|
271
273
|
# Get the details of an artilcle in a project
|
272
274
|
#
|
273
275
|
# @param project_id [Integer] Figshare id of the project
|
@@ -276,10 +278,10 @@ module Figshare
|
|
276
278
|
# @yield [Hash] See Fishare API docs for article hash
|
277
279
|
def article_detail(project_id:, article_id:, impersonate: nil, &block)
|
278
280
|
args = {}
|
279
|
-
args[
|
281
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
280
282
|
get(api_query: "account/projects/#{project_id}/articles/#{article_id}", args: args, &block)
|
281
283
|
end
|
282
|
-
|
284
|
+
|
283
285
|
# Get the files associated with an artilcle in a project
|
284
286
|
#
|
285
287
|
# @param project_id [Integer] Figshare id of the project
|
@@ -288,10 +290,10 @@ module Figshare
|
|
288
290
|
# @yield [Hash] See Fishare API docs for article hash
|
289
291
|
def artilce_files(project_id:, article_id:, impersonate: nil, &block)
|
290
292
|
args = {}
|
291
|
-
args[
|
293
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
292
294
|
get(api_query: "account/projects/#{project_id}/articles/#{article_id}/files", args: args, &block)
|
293
295
|
end
|
294
|
-
|
296
|
+
|
295
297
|
# Get the files associated with an artilcle in a project
|
296
298
|
#
|
297
299
|
# @param project_id [Integer] Figshare id of the project
|
@@ -300,9 +302,8 @@ module Figshare
|
|
300
302
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
301
303
|
def artilce_file_detail(project_id:, article_id:, file_id:, impersonate: nil, &block)
|
302
304
|
args = {}
|
303
|
-
args[
|
305
|
+
args['impersonate'] = impersonate unless impersonate.nil?
|
304
306
|
delete(api_query: "account/projects/#{project_id}/articles/#{article_id}/files/#{file_id}", args: args, &block)
|
305
307
|
end
|
306
|
-
|
307
|
-
|
308
|
-
end # End of Module
|
308
|
+
end
|
309
|
+
end
|
data/lib/public_articles.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
module Figshare
|
2
|
-
|
3
2
|
# Figshare Public Articles API
|
4
3
|
#
|
5
4
|
class PublicArticles < Base
|
6
|
-
|
7
5
|
# Requests a list of public articles
|
8
6
|
#
|
9
7
|
# @param institution [Boolean] Just our institution
|
@@ -17,23 +15,29 @@ module Figshare
|
|
17
15
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
18
16
|
# @param order_direction [String] "desc" Default, "asc"
|
19
17
|
# @yield [Hash] {id, title, doi, handle, url, published_date}
|
20
|
-
def list(institute: false,
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
def list( institute: false,
|
19
|
+
group_id: nil,
|
20
|
+
published_since: nil,
|
21
|
+
modified_since: nil,
|
22
|
+
item_type: nil,
|
23
|
+
resource_doi: nil,
|
24
|
+
doi: nil,
|
25
|
+
handle: nil,
|
26
|
+
order: 'published_date',
|
27
|
+
order_direction: 'desc',
|
28
|
+
&block
|
29
|
+
)
|
26
30
|
args = {}
|
27
|
-
args['institution'] = @institute_id
|
28
|
-
args['group_id'] = group_id
|
29
|
-
args['item_type'] = item_type
|
30
|
-
args['resource_doi'] = resource_doi
|
31
|
-
args['doi'] = doi
|
32
|
-
args['handle'] = handle
|
33
|
-
args['published_since'] = published_since
|
34
|
-
args['modified_since'] = modified_since
|
35
|
-
args['order'] = order
|
36
|
-
args['order_direction'] = order_direction
|
31
|
+
args['institution'] = @institute_id unless institute.nil?
|
32
|
+
args['group_id'] = group_id unless group_id.nil?
|
33
|
+
args['item_type'] = item_type unless item_type.nil?
|
34
|
+
args['resource_doi'] = resource_doi unless resource_doi.nil?
|
35
|
+
args['doi'] = doi unless doi.nil?
|
36
|
+
args['handle'] = handle unless handle.nil?
|
37
|
+
args['published_since'] = published_since unless published_since.nil?
|
38
|
+
args['modified_since'] = modified_since unless modified_since.nil?
|
39
|
+
args['order'] = order unless order.nil?
|
40
|
+
args['order_direction'] = order_direction unless order_direction.nil?
|
37
41
|
get_paginate(api_query: 'articles', args: args, &block)
|
38
42
|
end
|
39
43
|
|
@@ -50,24 +54,30 @@ module Figshare
|
|
50
54
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
51
55
|
# @param order_direction [String] "desc" Default, "asc"
|
52
56
|
# @yield [Hash] {id, title, doi, handle, url, published_date}
|
53
|
-
def search(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
def search( search_for:,
|
58
|
+
institute: false,
|
59
|
+
group_id: nil,
|
60
|
+
published_since: nil,
|
61
|
+
modified_since: nil,
|
62
|
+
item_type: nil,
|
63
|
+
resource_doi: nil,
|
64
|
+
doi: nil,
|
65
|
+
handle: nil,
|
66
|
+
order: 'published_date',
|
67
|
+
order_direction: 'desc',
|
68
|
+
&block
|
69
|
+
)
|
60
70
|
args = { 'search_for' => search_for }
|
61
|
-
args['institution'] = @institute_id
|
62
|
-
args['group_id'] = group_id
|
63
|
-
args['item_type'] = item_type
|
64
|
-
args['resource_doi'] = resource_doi
|
65
|
-
args['doi'] = doi
|
66
|
-
args['handle'] = handle
|
67
|
-
args['published_since'] = published_since
|
68
|
-
args['modified_since'] = modified_since
|
69
|
-
args['order'] = order
|
70
|
-
args['order_direction'] = order_direction
|
71
|
+
args['institution'] = @institute_id unless institute.nil?
|
72
|
+
args['group_id'] = group_id unless group_id.nil?
|
73
|
+
args['item_type'] = item_type unless item_type.nil?
|
74
|
+
args['resource_doi'] = resource_doi unless resource_doi.nil?
|
75
|
+
args['doi'] = doi unless doi.nil?
|
76
|
+
args['handle'] = handle unless handle.nil?
|
77
|
+
args['published_since'] = published_since unless published_since.nil?
|
78
|
+
args['modified_since'] = modified_since unless modified_since.nil?
|
79
|
+
args['order'] = order unless order.nil?
|
80
|
+
args['order_direction'] = order_direction unless order_direction.nil?
|
71
81
|
post(api_query: 'articles/search', args: args, &block)
|
72
82
|
end
|
73
83
|
|
@@ -76,17 +86,17 @@ module Figshare
|
|
76
86
|
# @param article_id [Integer] Figshare id of the article
|
77
87
|
# @yield [Hash] See figshare api docs
|
78
88
|
def detail(article_id:, &block)
|
79
|
-
get(api_query: "articles/#{article_id}",
|
89
|
+
get(api_query: "articles/#{article_id}", &block)
|
80
90
|
end
|
81
|
-
|
91
|
+
|
82
92
|
# Return details of list of versions for a specific article
|
83
93
|
#
|
84
94
|
# @param article_id [Integer] Figshare id of the artcle
|
85
95
|
# @yield [Hash] See figshare api docs
|
86
96
|
def versions(article_id:, &block)
|
87
|
-
get(api_query: "articles/#{article_id}/versions",
|
97
|
+
get(api_query: "articles/#{article_id}/versions", &block)
|
88
98
|
end
|
89
|
-
|
99
|
+
|
90
100
|
# Return details of specific article version
|
91
101
|
#
|
92
102
|
# @param article_id [Integer] Figshare id of the article
|
@@ -94,16 +104,16 @@ module Figshare
|
|
94
104
|
# @param embargo [Boolean] Include only embargoed items
|
95
105
|
# @param confidentiality [Boolean] Include only confidential items
|
96
106
|
# @yield [Hash] See figshare api docs
|
97
|
-
def version_detail(article_id:, version_id
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
107
|
+
def version_detail(article_id:, version_id:, embargo: false, confidentiality: false, &block)
|
108
|
+
if embargo
|
109
|
+
get(api_query: "articles/#{article_id}/versions/#{version_id}/embargo", &block)
|
110
|
+
elsif confidentiality
|
111
|
+
get(api_query: "articles/#{article_id}/versions/#{version_id}/confidentiality", &block)
|
112
|
+
else
|
113
|
+
get(api_query: "articles/#{article_id}/versions/#{version_id}", &block)
|
114
|
+
end
|
105
115
|
end
|
106
|
-
|
116
|
+
|
107
117
|
# Return details of list of files for a specific articles
|
108
118
|
#
|
109
119
|
# @param article_id [Integer] Figshare id of the article
|
@@ -111,7 +121,7 @@ module Figshare
|
|
111
121
|
def files(article_id:)
|
112
122
|
get(api_query: "articles/#{article_id}/files", &block)
|
113
123
|
end
|
114
|
-
|
124
|
+
|
115
125
|
# Return details of a specific file for a specific articles
|
116
126
|
#
|
117
127
|
# @param article_id [Integer] Figshare id of the article
|
@@ -120,6 +130,5 @@ module Figshare
|
|
120
130
|
def file_detail(article_id:, file_id:)
|
121
131
|
get(api_query: "articles/#{article_id}/files/#{file_id}", &block)
|
122
132
|
end
|
123
|
-
|
124
133
|
end
|
125
|
-
end
|
134
|
+
end
|