figshare_api_v2 0.9.7 → 0.9.10
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 +66 -0
- data/README.md +3 -2
- data/lib/authors.rb +16 -4
- data/lib/base.rb +100 -24
- data/lib/figshare_api_v2.rb +1 -1
- data/lib/institutions.rb +176 -31
- data/lib/other.rb +12 -4
- data/lib/private_articles.rb +140 -23
- data/lib/private_collections.rb +80 -18
- data/lib/private_projects.rb +109 -33
- data/lib/public_articles.rb +15 -3
- data/lib/public_collections.rb +29 -2
- data/lib/public_projects.rb +19 -1
- metadata +7 -4
data/lib/private_projects.rb
CHANGED
@@ -8,14 +8,32 @@ module Figshare
|
|
8
8
|
# @param roles [String] Any combination of owner, collaborator, viewer separated by comma. Examples: "owner" or "owner,collaborator".
|
9
9
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
10
10
|
# @param order_direction [String] "desc" Default, "asc"
|
11
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
12
|
+
# @param page_size [Numeric]
|
13
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
14
|
+
# @param limit [Numeric]
|
11
15
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
12
|
-
# @yield [
|
13
|
-
def list(storage: nil,
|
16
|
+
# @yield [Array] [{role, storage, url, published_date, id, title}]
|
17
|
+
def list( storage: nil,
|
18
|
+
roles: nil,
|
19
|
+
order: 'published_date',
|
20
|
+
order_direction: 'desc',
|
21
|
+
page: nil,
|
22
|
+
page_size: nil,
|
23
|
+
offset: nil,
|
24
|
+
limit: nil,
|
25
|
+
impersonate: nil,
|
26
|
+
&block
|
27
|
+
)
|
14
28
|
args = {}
|
15
29
|
args['storage'] = storage unless storage.nil?
|
16
30
|
args['roles'] = roles unless roles.nil?
|
17
31
|
args['order'] = order unless order.nil?
|
18
32
|
args['order_direction'] = order_direction unless order_direction.nil?
|
33
|
+
args['page'] = page unless page.nil?
|
34
|
+
args['page_size'] = page_size unless page_size.nil?
|
35
|
+
args['offset'] = offset unless offset.nil?
|
36
|
+
args['limit'] = limit unless limit.nil?
|
19
37
|
args['impersonate'] = impersonate unless impersonate.nil?
|
20
38
|
get_paginate(api_query: 'account/projects', args: args, &block)
|
21
39
|
end
|
@@ -29,15 +47,19 @@ module Figshare
|
|
29
47
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
30
48
|
# @param order_direction [String] "desc" Default, "asc"
|
31
49
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
32
|
-
# @yield [Hash] {id, title,
|
50
|
+
# @yield [Hash] {id, title, url, role, storage, published_date}
|
33
51
|
def search( search_for:,
|
34
52
|
institute: false,
|
35
53
|
group_id: nil,
|
36
|
-
impersonate: nil,
|
37
54
|
published_since: nil,
|
38
55
|
modified_since: nil,
|
39
56
|
order: 'published_date',
|
40
57
|
order_direction: 'desc',
|
58
|
+
page: nil,
|
59
|
+
page_size: nil,
|
60
|
+
offset: nil,
|
61
|
+
limit: nil,
|
62
|
+
impersonate: nil,
|
41
63
|
&block
|
42
64
|
)
|
43
65
|
args = { 'search_for' => search_for }
|
@@ -48,25 +70,31 @@ module Figshare
|
|
48
70
|
args['modified_since'] = modified_since unless modified_since.nil?
|
49
71
|
args['order'] = order unless order.nil?
|
50
72
|
args['order_direction'] = order_direction unless order_direction.nil?
|
51
|
-
|
73
|
+
args['page'] = page unless page.nil?
|
74
|
+
args['page_size'] = page_size unless page_size.nil?
|
75
|
+
args['offset'] = offset unless offset.nil?
|
76
|
+
args['limit'] = limit unless limit.nil?
|
77
|
+
post_paginate(api_query: 'account/projects/search', args: args, &block)
|
52
78
|
end
|
53
79
|
|
54
80
|
# Create a new project
|
55
81
|
#
|
56
82
|
# @param title [String]
|
57
83
|
# @param description [String]
|
84
|
+
# #param group_id [Integer] Figshare group the project falls under.
|
58
85
|
# @param funding [String]
|
59
86
|
# @param funding_list [Array] [{id, title}, ... ]
|
60
|
-
#
|
87
|
+
# @param custom_field_list [Array] [{name, value}, ... ]
|
61
88
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
62
89
|
# @yield [Hash] { location }
|
63
|
-
def create(title:, description:, group_id:, funding: '', funding_list: [], impersonate: nil, &block)
|
90
|
+
def create(title:, description:, group_id:, funding: '', funding_list: [], custom_field_list: nil, impersonate: nil, &block)
|
64
91
|
args = { 'title' => title,
|
65
92
|
'description' => description,
|
66
93
|
'group_id' => group_id,
|
67
94
|
'funding' => funding,
|
68
95
|
'funding_list' => funding_list
|
69
96
|
}
|
97
|
+
args['custom_field_list'] = custom_field_list unless custom_field_list.nil?
|
70
98
|
args['impersonate'] = impersonate unless impersonate.nil?
|
71
99
|
post(api_query: 'account/projects', args: args, &block)
|
72
100
|
end
|
@@ -99,14 +127,16 @@ module Figshare
|
|
99
127
|
# @param description [String]
|
100
128
|
# @param funding [String]
|
101
129
|
# @param funding_list [Array] [{id, title}, ... ]
|
130
|
+
# @param custom_field_list [Array] [{name, value}, ... ]
|
102
131
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
103
132
|
# @yield [Hash] { location }
|
104
|
-
def update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, impersonate: nil, &block)
|
133
|
+
def update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, custom_field_list: nil, impersonate: nil, &block)
|
105
134
|
args = {}
|
106
135
|
args['title'] = title unless title.nil?
|
107
136
|
args['description'] = description unless description.nil?
|
108
137
|
args['funding'] = funding unless funding.nil?
|
109
138
|
args['funding_list'] = funding_list unless funding_list.nil?
|
139
|
+
args['custom_field_list'] = custom_field_list unless custom_field_list.nil?
|
110
140
|
args['impersonate'] = impersonate unless impersonate.nil?
|
111
141
|
put(api_query: "account/projects/#{project_id}", args: args, &block)
|
112
142
|
end
|
@@ -115,7 +145,7 @@ module Figshare
|
|
115
145
|
#
|
116
146
|
# @param project_id [Integer] Figshare id of the project
|
117
147
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
118
|
-
# @yield [Hash] Message
|
148
|
+
# @yield [Hash] {Message:}
|
119
149
|
def publish(project_id:, impersonate: nil, &block)
|
120
150
|
args = {}
|
121
151
|
args['impersonate'] = impersonate unless impersonate.nil?
|
@@ -125,10 +155,25 @@ module Figshare
|
|
125
155
|
# List projects notes
|
126
156
|
#
|
127
157
|
# @param project_id [Integer] Figshare id of the project
|
158
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
159
|
+
# @param page_size [Numeric]
|
160
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
161
|
+
# @param limit [Numeric]
|
128
162
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
129
|
-
# @yield [
|
130
|
-
def notes(project_id:,
|
163
|
+
# @yield [Array] [{id:, user_id:, abstract:, user_name:, created_date:, modified_date:}]
|
164
|
+
def notes( project_id:,
|
165
|
+
page: nil,
|
166
|
+
page_size: nil,
|
167
|
+
offset: nil,
|
168
|
+
limit: nil,
|
169
|
+
impersonate: nil,
|
170
|
+
&block
|
171
|
+
)
|
131
172
|
args = {}
|
173
|
+
args['page'] = page unless page.nil?
|
174
|
+
args['page_size'] = page_size unless page_size.nil?
|
175
|
+
args['offset'] = offset unless offset.nil?
|
176
|
+
args['limit'] = limit unless limit.nil?
|
132
177
|
args['impersonate'] = impersonate unless impersonate.nil?
|
133
178
|
get_paginate(api_query: "account/projects/#{project_id}/notes", args: args, &block)
|
134
179
|
end
|
@@ -161,8 +206,8 @@ module Figshare
|
|
161
206
|
# @param project_id [Integer] Figshare id of the project
|
162
207
|
# @param note_id [Integer] Figshare id of the note
|
163
208
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
164
|
-
# @yield [Hash] { text }
|
165
|
-
def note_detail(impersonate: nil, &block)
|
209
|
+
# @yield [Hash] { text:, id:, user_id:, abstract:, user_name:, created_date:, modified_data: }
|
210
|
+
def note_detail(project_id:, note_id:, impersonate: nil, &block)
|
166
211
|
args = {}
|
167
212
|
args['impersonate'] = impersonate unless impersonate.nil?
|
168
213
|
get(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block)
|
@@ -180,10 +225,10 @@ module Figshare
|
|
180
225
|
put(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block)
|
181
226
|
end
|
182
227
|
|
183
|
-
# Leave a project (
|
228
|
+
# Leave a project (Note: project's owner cannot leave the project.)
|
184
229
|
#
|
185
230
|
# @param project_id [Integer] Figshare id of the project_id
|
186
|
-
def
|
231
|
+
def project_collaborators_leave(project_id:, impersonate: nil, &block)
|
187
232
|
args = {}
|
188
233
|
args['impersonate'] = impersonate unless impersonate.nil?
|
189
234
|
post(api_query: "account/projects/#{project_id}/leave", args: args, &block)
|
@@ -193,7 +238,7 @@ module Figshare
|
|
193
238
|
#
|
194
239
|
# @param project_id [Integer] Figshare id of the project_id
|
195
240
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
196
|
-
# @yield [
|
241
|
+
# @yield [Array] [{ status:, role_name:, user_id:, name: }]
|
197
242
|
def collaborators(project_id:, impersonate: nil, &block)
|
198
243
|
args = {}
|
199
244
|
args['impersonate'] = impersonate unless impersonate.nil?
|
@@ -203,23 +248,20 @@ module Figshare
|
|
203
248
|
# Invite a new collaborators to the project
|
204
249
|
#
|
205
250
|
# @param project_id [Integer] Figshare id of the project_id
|
206
|
-
# @param role_name [String]
|
207
|
-
# @param user_id [Integer] Need user_id or email
|
208
|
-
# @param email [String]
|
251
|
+
# @param role_name [String] "viewer", ...
|
252
|
+
# @param user_id [Integer] Need user_id and/or email
|
253
|
+
# @param email [String] Need user_id and/or email
|
209
254
|
# @param comment [String]
|
210
255
|
# @yield [String] { message }
|
211
256
|
def collaborator_invite(project_id:, role_name:, comment:, user_id: nil, email: nil, impersonate: nil, &block)
|
257
|
+
raise 'collaborator_invite(): Need a user_id or an email address' if user_id.nil? && email.nil?
|
258
|
+
|
212
259
|
args = {
|
213
260
|
'role_name' => role_name,
|
214
261
|
'comment' => comment
|
215
262
|
}
|
216
|
-
|
217
|
-
|
218
|
-
elsif ! email.nil?
|
219
|
-
args['email'] = email
|
220
|
-
else
|
221
|
-
raise 'collaborator_invite(): Need a user_id or an email address'
|
222
|
-
end
|
263
|
+
args['user_id'] = user_id unless user_id.nil?
|
264
|
+
args['email'] = email unless email.nil?
|
223
265
|
args['impersonate'] = impersonate unless impersonate.nil?
|
224
266
|
collaborator = { 'role_name' => role_name, 'user_id' => user_id, 'email' => email, 'comment' => comment }
|
225
267
|
post(api_query: "account/project/#{project_id}/collaborators", args: args, data: collaborator, &block)
|
@@ -231,6 +273,8 @@ module Figshare
|
|
231
273
|
# @param user_id [Integer] Figshare id of a user in the project
|
232
274
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
233
275
|
def collaborator_remove(project_id:, user_id:, impersonate: nil, &block)
|
276
|
+
raise 'collaborator_remove(): Need a user_id' if user_id.nil?
|
277
|
+
|
234
278
|
args = {}
|
235
279
|
args['impersonate'] = impersonate unless impersonate.nil?
|
236
280
|
delete(api_query: "account/project/#{project_id}/collaborators/#{user_id}", args: args, &block)
|
@@ -239,10 +283,25 @@ module Figshare
|
|
239
283
|
# Return details of list of articles for a specific project
|
240
284
|
#
|
241
285
|
# @param project_id [Integer] Figshare id of the project
|
286
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
287
|
+
# @param page_size [Numeric]
|
288
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
289
|
+
# @param limit [Numeric]
|
242
290
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
243
|
-
# @yield [
|
244
|
-
def articles(project_id:,
|
291
|
+
# @yield [Array] See Figshare API Doc
|
292
|
+
def articles( project_id:,
|
293
|
+
page: nil,
|
294
|
+
page_size: nil,
|
295
|
+
offset: nil,
|
296
|
+
limit: nil,
|
297
|
+
impersonate: nil,
|
298
|
+
&block
|
299
|
+
)
|
245
300
|
args = {}
|
301
|
+
args['page'] = page unless page.nil?
|
302
|
+
args['page_size'] = page_size unless page_size.nil?
|
303
|
+
args['offset'] = offset unless offset.nil?
|
304
|
+
args['limit'] = limit unless limit.nil?
|
246
305
|
args['impersonate'] = impersonate unless impersonate.nil?
|
247
306
|
get_paginate(api_query: "account/projects/#{project_id}/articles", args: args, &block)
|
248
307
|
end
|
@@ -250,10 +309,27 @@ module Figshare
|
|
250
309
|
# Create a new Article and associate it with this project
|
251
310
|
#
|
252
311
|
# @param project_id [Integer] Figshare id of the project
|
312
|
+
# @param article_record [Hash] See docs.figshare.com
|
313
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
314
|
+
# @param page_size [Numeric]
|
315
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
316
|
+
# @param limit [Numeric]
|
253
317
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
254
|
-
# @yield [Hash] { location }
|
255
|
-
def article_create(project_id:,
|
256
|
-
|
318
|
+
# @yield [Hash] { entity_id:, location:, warnings: [ "string" ] }
|
319
|
+
def article_create( project_id:,
|
320
|
+
article_record: nil,
|
321
|
+
page: nil,
|
322
|
+
page_size: nil,
|
323
|
+
offset: nil,
|
324
|
+
limit: nil,
|
325
|
+
impersonate: nil,
|
326
|
+
&block
|
327
|
+
)
|
328
|
+
args = { 'article' => article_record }
|
329
|
+
args['page'] = page unless page.nil?
|
330
|
+
args['page_size'] = page_size unless page_size.nil?
|
331
|
+
args['offset'] = offset unless offset.nil?
|
332
|
+
args['limit'] = limit unless limit.nil?
|
257
333
|
args['impersonate'] = impersonate unless impersonate.nil?
|
258
334
|
# Figshare Docs say this should be post_paginate, but that makes no sense. Will have to test
|
259
335
|
post_paginate(api_query: "account/projects/#{project_id}/articles", args: args, &block)
|
@@ -275,7 +351,7 @@ module Figshare
|
|
275
351
|
# @param project_id [Integer] Figshare id of the project
|
276
352
|
# @param article_id [Integer] Figshare id of the article
|
277
353
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
278
|
-
# @yield [Hash] See
|
354
|
+
# @yield [Hash] See docs.figshare.com for article hash
|
279
355
|
def article_detail(project_id:, article_id:, impersonate: nil, &block)
|
280
356
|
args = {}
|
281
357
|
args['impersonate'] = impersonate unless impersonate.nil?
|
@@ -287,7 +363,7 @@ module Figshare
|
|
287
363
|
# @param project_id [Integer] Figshare id of the project
|
288
364
|
# @param article_id [Integer] Figshare id of the article
|
289
365
|
# @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
|
290
|
-
# @yield [
|
366
|
+
# @yield [Array] See docs.figshare.com
|
291
367
|
def artilce_files(project_id:, article_id:, impersonate: nil, &block)
|
292
368
|
args = {}
|
293
369
|
args['impersonate'] = impersonate unless impersonate.nil?
|
data/lib/public_articles.rb
CHANGED
@@ -14,7 +14,11 @@ module Figshare
|
|
14
14
|
# @param handle [String] Matches this handle
|
15
15
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
16
16
|
# @param order_direction [String] "desc" Default, "asc"
|
17
|
-
# @
|
17
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
18
|
+
# @param page_size [Numeric]
|
19
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
20
|
+
# @param limit [Numeric]
|
21
|
+
# @yield [Array] [{id, title, doi, handle, url, published_date,...}] see docs.figshare.com
|
18
22
|
def list( institute: false,
|
19
23
|
group_id: nil,
|
20
24
|
published_since: nil,
|
@@ -25,11 +29,15 @@ module Figshare
|
|
25
29
|
handle: nil,
|
26
30
|
order: 'published_date',
|
27
31
|
order_direction: 'desc',
|
32
|
+
page: nil,
|
33
|
+
page_size: nil,
|
34
|
+
offset: nil,
|
35
|
+
limit: nil,
|
28
36
|
&block
|
29
37
|
)
|
30
38
|
args = {}
|
31
39
|
args['institution'] = @institute_id unless institute.nil?
|
32
|
-
args['group_id'] = group_id unless group_id.nil?
|
40
|
+
args['group_id'] = group_id unless group_id.nil? # Not sure if this should be 'group' or 'group_id'. API has conflicting info
|
33
41
|
args['item_type'] = item_type unless item_type.nil?
|
34
42
|
args['resource_doi'] = resource_doi unless resource_doi.nil?
|
35
43
|
args['doi'] = doi unless doi.nil?
|
@@ -38,6 +46,10 @@ module Figshare
|
|
38
46
|
args['modified_since'] = modified_since unless modified_since.nil?
|
39
47
|
args['order'] = order unless order.nil?
|
40
48
|
args['order_direction'] = order_direction unless order_direction.nil?
|
49
|
+
args['page'] = page unless page.nil?
|
50
|
+
args['page_size'] = page_size unless page_size.nil?
|
51
|
+
args['offset'] = offset unless offset.nil?
|
52
|
+
args['limit'] = limit unless limit.nil?
|
41
53
|
get_paginate(api_query: 'articles', args: args, &block)
|
42
54
|
end
|
43
55
|
|
@@ -127,7 +139,7 @@ module Figshare
|
|
127
139
|
# @param article_id [Integer] Figshare id of the article
|
128
140
|
# @param file_id [Integer] Figshare id of the file
|
129
141
|
# @yield [Hash] See figshare api docs
|
130
|
-
def file_detail(article_id:, file_id
|
142
|
+
def file_detail(article_id:, file_id:, &block)
|
131
143
|
get(api_query: "articles/#{article_id}/files/#{file_id}", &block)
|
132
144
|
end
|
133
145
|
end
|
data/lib/public_collections.rb
CHANGED
@@ -13,6 +13,10 @@ module Figshare
|
|
13
13
|
# @param handle [String] Matches this handle
|
14
14
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
15
15
|
# @param order_direction [String] "desc" Default, "asc"
|
16
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
17
|
+
# @param page_size [Numeric]
|
18
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
19
|
+
# @param limit [Numeric]
|
16
20
|
# @yield [Hash] {id, title, doi, handle, url, published_date}
|
17
21
|
def list( institution: false,
|
18
22
|
group_id: nil,
|
@@ -23,6 +27,10 @@ module Figshare
|
|
23
27
|
handle: nil,
|
24
28
|
order: 'published_date',
|
25
29
|
order_direction: 'desc',
|
30
|
+
page: nil,
|
31
|
+
page_size: nil,
|
32
|
+
offset: nil,
|
33
|
+
limit: nil,
|
26
34
|
&block
|
27
35
|
)
|
28
36
|
args = {}
|
@@ -35,6 +43,10 @@ module Figshare
|
|
35
43
|
args['modified_since'] = modified_since unless modified_since.nil?
|
36
44
|
args['order'] = order unless order.nil?
|
37
45
|
args['order_direction'] = order_direction unless order_direction.nil?
|
46
|
+
args['page'] = page unless page.nil?
|
47
|
+
args['page_size'] = page_size unless page_size.nil?
|
48
|
+
args['offset'] = offset unless offset.nil?
|
49
|
+
args['limit'] = limit unless limit.nil?
|
38
50
|
get_paginate(api_query: 'collections', args: args, &block)
|
39
51
|
end
|
40
52
|
|
@@ -97,6 +109,10 @@ module Figshare
|
|
97
109
|
#
|
98
110
|
# @param collection_id [Integer] Figshare id of the collection
|
99
111
|
# @param version_id [Integer] Figshare id of the collection's version
|
112
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
113
|
+
# @param page_size [Numeric]
|
114
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
115
|
+
# @param limit [Numeric]
|
100
116
|
# @yield [Hash] See figshare api docs
|
101
117
|
def version_detail(collection_id:, version_id:, &block)
|
102
118
|
get(api_query: "collections/#{collection_id}/versions/#{version_id}", &block)
|
@@ -106,8 +122,19 @@ module Figshare
|
|
106
122
|
#
|
107
123
|
# @param collection_id [Integer] Figshare id of the collection
|
108
124
|
# @yield [Hash] {id, title, doi, handle, url, published_date}
|
109
|
-
def articles(collection_id:,
|
110
|
-
|
125
|
+
def articles( collection_id:,
|
126
|
+
page: nil,
|
127
|
+
page_size: nil,
|
128
|
+
offset: nil,
|
129
|
+
limit: nil,
|
130
|
+
&block
|
131
|
+
)
|
132
|
+
args = {}
|
133
|
+
args['page'] = page unless page.nil?
|
134
|
+
args['page_size'] = page_size unless page_size.nil?
|
135
|
+
args['offset'] = offset unless offset.nil?
|
136
|
+
args['limit'] = limit unless limit.nil?
|
137
|
+
get_paginate(api_query: "collections/#{collection_id}/articles", args: args, &block)
|
111
138
|
end
|
112
139
|
end
|
113
140
|
end
|
data/lib/public_projects.rb
CHANGED
@@ -9,14 +9,32 @@ module Figshare
|
|
9
9
|
# @param published_since [Time] Return results if published after this time
|
10
10
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
11
11
|
# @param order_direction [String] "desc" Default, "asc"
|
12
|
+
# @param page [Numeric] Pages start at 1. Page and Page size go together
|
13
|
+
# @param page_size [Numeric]
|
14
|
+
# @param offset [Numeric] offset is 0 based. Offset and Limit go together
|
15
|
+
# @param limit [Numeric]
|
12
16
|
# @yield [Hash] {url, published_date, id, title}
|
13
|
-
def list(institute: false,
|
17
|
+
def list( institute: false,
|
18
|
+
group_id: nil,
|
19
|
+
published_since: nil,
|
20
|
+
order: 'published_date',
|
21
|
+
order_direction: 'desc',
|
22
|
+
page: nil,
|
23
|
+
page_size: nil,
|
24
|
+
offset: nil,
|
25
|
+
limit: nil,
|
26
|
+
&block
|
27
|
+
)
|
14
28
|
args = {}
|
15
29
|
args['institution'] = @institute_id unless institute.nil?
|
16
30
|
args['group'] = group_id unless group_id.nil?
|
17
31
|
args['published_since'] = published_since unless published_since.nil?
|
18
32
|
args['order'] = order unless order.nil?
|
19
33
|
args['order_direction'] = order_direction unless order_direction.nil?
|
34
|
+
args['page'] = page unless page.nil?
|
35
|
+
args['page_size'] = page_size unless page_size.nil?
|
36
|
+
args['offset'] = offset unless offset.nil?
|
37
|
+
args['limit'] = limit unless limit.nil?
|
20
38
|
get_paginate(api_query: 'projects', args: args, &block)
|
21
39
|
end
|
22
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figshare_api_v2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Burrowes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wikk_json
|
@@ -80,7 +80,10 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.23'
|
83
|
-
description:
|
83
|
+
description: |-
|
84
|
+
Figshare version 2 API.
|
85
|
+
|
86
|
+
Actually the second version of the version 2 APIs. Lots of changes have been made by Figshare, mostly expanding what is returned from the API calls, but they also added some fields. Looks mostly backwards compatible.
|
84
87
|
email:
|
85
88
|
- r.burrowes@auckland.ac.nz
|
86
89
|
executables: []
|
@@ -136,5 +139,5 @@ requirements: []
|
|
136
139
|
rubygems_version: 3.2.22
|
137
140
|
signing_key:
|
138
141
|
specification_version: 4
|
139
|
-
summary: Figshare version 2 API
|
142
|
+
summary: Figshare version 2 API
|
140
143
|
test_files: []
|