figshare_api_v2 0.9.9 → 0.9.11

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
  SHA256:
3
- metadata.gz: 5a59303e131674b6b915f07bf0e0aa317a3d5d594c8e87586fe273d8ed83697d
4
- data.tar.gz: b8bdb004509e69e295b110f60f98ac6da83ea2ea3c5d2bf72e9d46ec041d274a
3
+ metadata.gz: 1dc7e3baa60bb192090e8237e1439c3ad7100450ce253707f61b13a1fae0f3cf
4
+ data.tar.gz: d1890373d6110f860a42ea2f21c2cd2a698df7bcc0aa9d9de60f813768745d09
5
5
  SHA512:
6
- metadata.gz: ebdcee71baa8b80d0c434c9c041255a8843c897574c00725c60c288670854c0d3bce3e404805f03201951b981148ea8bfc49acf465b686af75cabd2bd47655f9
7
- data.tar.gz: 5cdd11942289e5cb75e4e09afd730ebd12209b161fc68221aa5dadc347a90fc04370d9af464c419b69ed7cb794097254d796cd318ffc9957402cd3736728328b
6
+ metadata.gz: 7c920fbae1eae2d5a84c072c2ff1e4eaa0e7b480314bc6333e2e3e5ebd34bdc5d8bc4b793284a8564ba410cdbe5d989324202e29857d93b85b673bceff4d51a8
7
+ data.tar.gz: 60ac5fdf5584a90966d8512701b61a2baace0d23f6889ee21213f6d6428d65f3120cf66589818b336693cc6a1f33f898c80af06e8b770c37d47cedf5d3148a35
data/History.txt CHANGED
@@ -1,3 +1,39 @@
1
+ robertburrowes Tue Sep 27 15:24:24 2022 +1300
2
+ Added in collection handling. Shifted author processing to figshare library
3
+ robertburrowes Tue Sep 27 14:39:31 2022 +1300
4
+ Authors shoud be an array of Hash records.
5
+ robertburrowes Tue Sep 27 14:39:06 2022 +1300
6
+ Added body() for creating the body Hash needed for creating a new Collection
7
+ robertburrowes Tue Sep 27 14:38:25 2022 +1300
8
+ typo in name
9
+ robertburrowes Tue Sep 27 12:11:20 2022 +1300
10
+ Bumped version for 'institute' needing to be an Integer in json
11
+ robertburrowes Tue Sep 27 12:09:20 2022 +1300
12
+ institute has to be an Integer. A string now generates an exception
13
+ robertburrowes Tue Sep 27 09:04:43 2022 +1300
14
+ Debugging bulk user info request. Still getting inconsistent numbers of users being returned.
15
+ robertburrowes Tue Sep 27 09:03:55 2022 +1300
16
+ Testing what comes back
17
+ robertburrowes Fri May 13 08:40:05 2022 +1200
18
+ Bumped minor version
19
+ robertburrowes Thu May 12 17:25:07 2022 +1200
20
+ Moved the accounts_wrapper() into institution.accounts(), less the debugging stuff
21
+ robertburrowes Thu May 12 17:06:48 2022 +1200
22
+ Comment
23
+ robertburrowes Thu May 12 16:52:57 2022 +1200
24
+ Check returned account IDs are in order (they do seem to be)
25
+ robertburrowes Thu May 12 16:32:58 2022 +1200
26
+ Incorporate the new id_gte into institute.accounts, as page/page_size pagination has a 9000 record limit.
27
+ robertburrowes Thu May 12 16:22:48 2022 +1200
28
+ return earlier, in _paginate, to not set 'page'
29
+ robertburrowes Thu May 12 15:56:44 2022 +1200
30
+ Added 'once_only' to the post and get _pagination calls, so we don't automatically move onto the next page.
31
+ robertburrowes Thu May 12 11:18:45 2022 +1200
32
+ Refactored _pagination response code to see if it helped fix the duplicate record issue. It didn't.
33
+ robertburrowes Thu May 12 09:43:45 2022 +1200
34
+ Added debug output of updated Figshare API.
35
+ robertburrowes Wed May 11 09:07:42 2022 +1200
36
+ update comments
1
37
  robertburrowes Tue May 10 10:42:27 2022 +1200
2
38
  Comment
3
39
  robertburrowes Tue May 10 10:40:02 2022 +1200
data/lib/authors.rb CHANGED
@@ -31,7 +31,7 @@ module Figshare
31
31
  &block
32
32
  )
33
33
  args = { 'search_for' => search_for }
34
- args['institution'] = @institute_id unless institute.nil?
34
+ args['institution'] = @institute_id.to_i if institute
35
35
  args['group_id'] = group_id unless group_id.nil?
36
36
  args['is_active'] = is_active unless is_active.nil?
37
37
  args['is_public'] = is_public unless is_public.nil?
data/lib/base.rb CHANGED
@@ -71,41 +71,53 @@ module Figshare
71
71
  # @param by_offset [Boolean] use offset/limit rather than page/page_size in API calls
72
72
  # @yield [String] if given a block, iterates through the result from figshare
73
73
  # @return [Integer] number of results.
74
- private def get_paginate(api_query:, args: {}, debug: false, by_offset: false, &block)
74
+ private def get_paginate(api_query:, args: {}, debug: false, by_offset: false, once_only: false, &block)
75
75
  args = {} if args.nil?
76
- if ! args.is_a?(Hash)
77
- raise 'get_paginate(): Expecting args to be a Hash'
78
- end
79
-
80
- # Loop variables, if we are using pages
81
- page = args['page'].nil? ? 1 : args['page']
82
- page_size = args['page_size'].nil? ? 100 : args['page_size']
83
-
84
- # Loop variables, if we are using offsets
85
- offset = args['offset'].nil? ? 0 : args['offset']
86
- limit = args['limit'].nil? ? 100 : args['limit']
76
+ raise 'get_paginate(): Expecting args to be a Hash' unless args.is_a?(Hash)
87
77
 
88
78
  by_offset = true if args['page'].nil? && ! args['offset'].nil?
79
+ if by_offset
80
+ # Loop variables, if we are using offsets
81
+ offset = args['offset'].nil? ? 0 : args['offset']
82
+ limit = args['limit'].nil? ? 100 : args['limit']
83
+ args['offset'] = offset
84
+ args['limit'] = limit
85
+ else
86
+ page = args['page'].nil? ? 1 : args['page']
87
+ page_size = args['page_size'].nil? ? 100 : args['page_size']
88
+ args['page'] = page
89
+ args['page_size'] = page_size
90
+ end
89
91
 
90
92
  # How many results so far.
91
93
  result_count = 0
92
94
 
93
95
  loop do
94
96
  content_type = response = nil
95
- form_args = by_offset ? { 'limit' => limit, 'offset' => offset } : { 'page_size' => page_size, 'page' => page }
96
97
  WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
97
98
  response = ws.get_page( query: "#{@api_url}#{api_query}",
98
99
  authorization: "token #{@auth_token}",
99
- form_values: form_args.merge(args)
100
+ form_values: args
100
101
  )
101
102
  content_type = ws.header_value(key: 'Content-Type')
102
103
  end
104
+ # File.write("/tmp/debug_#{args['id_gte']}_#{page}.json", response)
103
105
  page_count = iterate_json_response(response: response, content_type: content_type, debug: debug, &block)
104
106
  result_count += page_count
105
- break if page_count < page_size # Got less results than we asked for, so it was the last page
106
107
 
107
- page += 1 # Ready to fetch next page
108
- offset += limit # if we use offset, then mor
108
+ return result_count if once_only
109
+
110
+ if by_offset
111
+ break if page_count < limit # Got less results than we asked for, so it was the last page
112
+
113
+ offset += limit # if we use offset
114
+ args['offset'] = offset
115
+ else
116
+ break if page_count < page_size # Got less results than we asked for, so it was the last page
117
+
118
+ page += 1 # Ready to fetch next page
119
+ args['page'] = page
120
+ end
109
121
  end
110
122
 
111
123
  return result_count
@@ -156,42 +168,54 @@ module Figshare
156
168
  # @param by_offset [Boolean] use offset/limit rather than page/page_size in API calls
157
169
  # @yield [String] if given a block, iterates through the result from figshare
158
170
  # @return [Integer] number of results.
159
- private def post_paginate(api_query:, args: {}, debug: false, by_offset: false, &block)
171
+ private def post_paginate(api_query:, args: {}, debug: false, by_offset: false, once_only: false, &block)
160
172
  # Loop variables, if we are using pages
161
- page = args['page'].nil? ? 1 : args['page']
162
- page_size = args['page_size'].nil? ? 100 : args['page_size']
173
+ args = {} if args.nil?
174
+ raise 'post_paginate(): Expecting args to be a Hash' unless args.is_a?(Hash)
163
175
 
164
- # Loop variables, if we are using offsets
165
- offset = args['offset'].nil? ? 0 : args['offset']
166
- limit = args['limit'].nil? ? 100 : args['limit']
176
+ by_offset = true if args['page'].nil? && ! args['offset'].nil?
177
+ if by_offset
178
+ # Loop variables, if we are using offsets
179
+ offset = args['offset'].nil? ? 0 : args['offset']
180
+ limit = args['limit'].nil? ? 100 : args['limit']
181
+ args['offset'] = offset
182
+ args['limit'] = limit
183
+ else
184
+ page = args['page'].nil? ? 1 : args['page']
185
+ page_size = args['page_size'].nil? ? 100 : args['page_size']
186
+ args['page'] = page
187
+ args['page_size'] = page_size
188
+ end
167
189
 
168
190
  # How many results so far.
169
191
  result_count = 0
170
192
 
171
- by_offset = true if args['page'].nil? && ! args['offset'].nil?
172
-
173
- args = {} if args.nil?
174
- if ! args.is_a?(Hash)
175
- raise 'post_paginate(): Expecting args to be a Hash'
176
- end
177
-
178
193
  loop do
179
194
  content_type = response = nil
180
- form_args = by_offset ? { 'limit' => limit, 'offset' => offset } : { 'page_size' => page_size, 'page' => page }
181
195
  WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
182
196
  response = ws.post_page( query: "#{@api_url}#{api_query}",
183
197
  content_type: 'application/json; charset=UTF-8',
184
198
  authorization: "token #{@auth_token}",
185
- data: args.merge(form_args).to_j
199
+ data: args.to_j
186
200
  )
187
201
  content_type = ws.header_value(key: 'Content-Type')
188
202
  end
189
203
  page_count = iterate_json_response(response: response, content_type: content_type, debug: debug, &block)
190
204
  result_count += page_count
191
- break if page_count < page_size # Got less results than we asked for, so it was the last page
192
205
 
193
- page += 1 # Ready to fetch next page
194
- offset += limit # if we use offset
206
+ return result_count if once_only
207
+
208
+ if by_offset
209
+ break if page_count < limit # Got less results than we asked for, so it was the last page
210
+
211
+ offset += limit # if we use offset
212
+ args['offset'] = offset
213
+ else
214
+ break if page_count < page_size # Got less results than we asked for, so it was the last page
215
+
216
+ page += 1 # Ready to fetch next page
217
+ args['page'] = page
218
+ end
195
219
  end
196
220
  return result_count
197
221
  end
@@ -1,7 +1,7 @@
1
1
  module Figshare # :nodoc:
2
2
  # Figshare module initialization
3
3
  #
4
- VERSION = '0.9.9'
4
+ VERSION = '0.9.11'
5
5
 
6
6
  require 'wikk_webbrowser'
7
7
  require 'wikk_json'
data/lib/institutions.rb CHANGED
@@ -14,9 +14,9 @@ module Figshare
14
14
  end
15
15
  end
16
16
 
17
- # Get the institional account details
17
+ # Get the institional account's details (not a person's account details)
18
18
  #
19
- # @yield [Hash]
19
+ # @yield [Hash] {id:, name: "institute"}
20
20
  def account(&block)
21
21
  get(api_query: 'account/institution', &block)
22
22
  end
@@ -137,12 +137,13 @@ module Figshare
137
137
  end
138
138
 
139
139
  # Get the accounts for which the account has administrative privileges (assigned and inherited).
140
+ # Accounts are returned in account id order, and there is a 9000 user upper limit. See id_gte.
140
141
  #
141
142
  # @param is_active [Boolean] user account is active
142
143
  # @param institution_user_id [String] As set in the HR upload
143
144
  # @param email [String] as set in the HR upload
144
- # @param id_lte [Integer] ID is <=
145
- # @param id_gte [Integer] ID is >=
145
+ # @param id_lte [Integer] ID is <= Introduced to get around the buffer limit of 9000 users
146
+ # @param id_gte [Integer] ID is >= Introduced to get around the buffer limit of 9000 users
146
147
  # @param page [Numeric] Pages start at 1. Page and Page size go together
147
148
  # @param page_size [Numeric]
148
149
  # @param offset [Numeric] offset is 0 based. Offset and Limit go together
@@ -157,6 +158,7 @@ module Figshare
157
158
  page_size: nil,
158
159
  offset: nil,
159
160
  limit: nil,
161
+ cursor_pagination: true,
160
162
  &block
161
163
  )
162
164
  args = {}
@@ -169,7 +171,26 @@ module Figshare
169
171
  args['page_size'] = page_size unless page_size.nil?
170
172
  args['offset'] = offset unless offset.nil?
171
173
  args['limit'] = limit unless limit.nil?
172
- get_paginate(api_query: 'account/institution/accounts', args: args, &block)
174
+ if cursor_pagination
175
+ highest_id_gte = 0
176
+ args['id_lte'] = nil
177
+ args['page_size'] = 100
178
+ loop do
179
+ count = 0
180
+ args['page'] = 1
181
+ args['id_gte'] = highest_id_gte + 1
182
+ get_paginate(api_query: 'account/institution/accounts', args: args, once_only: true) do |account|
183
+ next if account.nil? || account['id'].nil?
184
+
185
+ count += 1
186
+ highest_id_gte = account['id'].to_i if highest_id_gte < account['id'].to_i
187
+ yield account
188
+ end
189
+ break if count < 100 # Didn't reach the page_size limit.
190
+ end
191
+ else # Do it the old broken way (Pagination only works for the first 9000 entries)
192
+ get_paginate(api_query: 'account/institution/accounts', args: args, &block)
193
+ end
173
194
  end
174
195
 
175
196
  # Create new Institution Account
@@ -67,7 +67,7 @@ module Figshare
67
67
  )
68
68
  args = { 'search_for' => search_for }
69
69
  args['impersonate'] = impersonate unless impersonate.nil?
70
- args['institution'] = @institute_id unless institute.nil? # Inconsistent use. Other calls use institute_id
70
+ args['institution'] = @institute_id.to_i if institute # Inconsistent use. Other calls use institute_id
71
71
  args['group'] = group_id unless group_id.nil? # Not sure if this changed from group_id to group
72
72
  args['item_type'] = item_type unless item_type.nil?
73
73
  args['resource_id'] = resource_id unless resource_id.nil?
@@ -138,7 +138,17 @@ module Figshare
138
138
  body_['references'] = references unless references.nil?
139
139
  body_['categories'] = categories unless categories.nil?
140
140
  body_['categories_by_source_id'] = categories_by_source_id unless categories_by_source_id.nil?
141
- body_['authors'] = authors unless authors.nil?
141
+ authors_array = []
142
+ if authors.instance_of?(Array)
143
+ authors.each do |author|
144
+ authors_array << if author.instance_of?(Hash)
145
+ author
146
+ else
147
+ { 'name' => author }
148
+ end
149
+ end
150
+ end
151
+ body_['authors'] = authors_array
142
152
  body_['custom_fields'] = custom_fields unless custom_fields.nil?
143
153
  body_['custom_fields_list'] = custom_fields_list unless custom_fields_list.nil?
144
154
  body_['defined_type'] = defined_type unless defined_type.nil?
@@ -70,7 +70,7 @@ module Figshare
70
70
  )
71
71
  args = { 'search_for' => search_for }
72
72
  args['impersonate'] = impersonate unless impersonate.nil?
73
- args['institution'] = @institute_id unless institute.nil?
73
+ args['institution'] = @institute_id.to_i if institute
74
74
  args['group'] = group_id unless group_id.nil?
75
75
  args['resource_id'] = resource_id unless resource_id.nil?
76
76
  args['resource_doi'] = resource_doi unless resource_doi.nil?
@@ -87,6 +87,89 @@ module Figshare
87
87
  post_paginate(api_query: 'account/collections/search', args: args, &block)
88
88
  end
89
89
 
90
+ # Create a body for use with create and update methods
91
+ #
92
+ # @param title [String] Required
93
+ # @param description [String] The article description. In a publisher case, usually this is the remote article description
94
+ # @param tags [Array] List of tags (strings) to be associated with the article. Tags can be used instead
95
+ # @param keywords [Array] List of tags (strings) to be associated with the article. Tags can be used instead
96
+ # @param references [Array] List of links to be associated with the article (e.g ["http://link1", "http://link2", "http://link3"])
97
+ # @param categories [Array] List of category ids to be associated with the article(e.g [1, 23, 33, 66])
98
+ # @param categories_by_source_id [Array] List of category ids to be associated with the article(e.g ["300204", "400207"])
99
+ # @param authors [Array] List of authors to be associated with the article. The list can contain the following fields: id, name, first_name, last_name, email, orcid_id. If an id is supplied, it will take priority and everything else will be ignored. No more than 10 authors. For adding more authors use the specific authors endpoint. e.g. { "name" => "Joe X"} and or { "id" => 123 }
100
+ # @param custom_fields [Hash] List of key, values pairs to be associated with the article. eg. { "key" => "value"}
101
+ # @param custom_fields_list [Array] List of key, values pairs to be associated with the article. eg. [{ "key" => "value"}]
102
+ # @param defined_type [String] one of "figshare","media","dataset","poster","journal contribution", "presentation", "thesis", "software", "online resource", "preprint", "book", "conference contribution", "chapter", "peer review", "educational resource", "report", "standard", "composition", "funding", "physical object", "data management plan", "workflow", "monograph", "performance", "event", "service", "model", "registration"
103
+ # @param funding [String] Grant number or funding authority
104
+ # @param funding_list [Array] Funding creation / update items. eg {"id" => 0, "title" => "string"}
105
+ # @param license [Integer] License id for this article.
106
+ # @param doi [String] Not applicable for regular users. In an institutional case, make sure your group supports setting DOIs. This setting is applied by figshare via opening a ticket through our support/helpdesk system.
107
+ # @param handle [String] Not applicable for regular users. In an institutional case, make sure your group supports setting Handles. This setting is applied by figshare via opening a ticket through our support/helpdesk system.
108
+ # @param resource_doi [String] Not applicable to regular users. In a publisher case, this is the publisher article DOI.
109
+ # @param resource_title [String] Not applicable to regular users. In a publisher case, this is the publisher article title.
110
+ # @param timeline [Hash] Various timeline dates ie. { "firstOnline" => "date_string", "publisherPublication" => "date_string", "publisherAcceptance" => "date_string"},
111
+ # @param group_id [Integer] Not applicable to regular users. This field is reserved to institutions/publishers with access to assign to specific groups
112
+ def body( title:,
113
+ description: nil,
114
+ is_metadata_record: nil,
115
+ metadata_reason: nil,
116
+ tags: nil,
117
+ keywords: nil,
118
+ references: nil,
119
+ categories: nil,
120
+ categories_by_source_id: nil,
121
+ authors: nil,
122
+ custom_fields: nil,
123
+ custom_fields_list: nil,
124
+ defined_type: nil,
125
+ funding: nil,
126
+ funding_list: nil,
127
+ license: nil,
128
+ doi: nil,
129
+ handle: nil,
130
+ resource_doi: nil,
131
+ resource_title: nil,
132
+ timeline: nil,
133
+ group_id: nil
134
+ )
135
+ body_ = {
136
+ 'title' => title
137
+ }
138
+ body_['description'] = description unless description.nil?
139
+ body_['is_metadata_record'] = is_metadata_record unless is_metadata_record.nil?
140
+ body_['metadata_reason'] = metadata_reason unless metadata_reason.nil?
141
+ body_['tags'] = tags unless tags.nil?
142
+ body_['keywords'] = keywords unless keywords.nil?
143
+ body_['references'] = references unless references.nil?
144
+ body_['categories'] = categories unless categories.nil?
145
+ body_['categories_by_source_id'] = categories_by_source_id unless categories_by_source_id.nil?
146
+ authors_array = []
147
+ if authors.instance_of?(Array)
148
+ authors.each do |author|
149
+ authors_array << if author.instance_of?(Hash)
150
+ author
151
+ else
152
+ { 'name' => author }
153
+ end
154
+ end
155
+ end
156
+ body_['authors'] = authors_array
157
+ body_['custom_fields'] = custom_fields unless custom_fields.nil?
158
+ body_['custom_fields_list'] = custom_fields_list unless custom_fields_list.nil?
159
+ body_['defined_type'] = defined_type unless defined_type.nil?
160
+ body_['funding'] = funding unless funding.nil?
161
+ body_['funding_list'] = funding_list unless funding_list.nil?
162
+ body_['license'] = license unless license.nil?
163
+ body_['doi'] = doi unless doi.nil?
164
+ body_['handle'] = handle unless handle.nil?
165
+ body_['resource_doi'] = resource_doi unless resource_doi.nil?
166
+ body_['resource_title'] = resource_title unless resource_title.nil?
167
+ body_['timeline'] = timeline unless timeline.nil?
168
+ body_['group_id'] = group_id unless group_id.nil?
169
+
170
+ return body_
171
+ end
172
+
90
173
  # Create a new private Collection by sending collection information
91
174
  #
92
175
  # @param body [Hash] See Figshare API docs
@@ -133,7 +216,7 @@ module Figshare
133
216
  #
134
217
  # @param collection_id [Integer] Figshare id of the collection
135
218
  # @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
136
- # @yield [Hash] { doi }
219
+ # @yield [Hash] { "doi" => "the_doi" }
137
220
  def reserve_doi(collection_id:, impersonate: nil, &block)
138
221
  args = {}
139
222
  args['impersonate'] = impersonate unless impersonate.nil?
@@ -63,7 +63,7 @@ module Figshare
63
63
  &block
64
64
  )
65
65
  args = { 'search_for' => search_for }
66
- args['institution'] = @institute_id unless institute.nil?
66
+ args['institution'] = @institute_id.to_i if institute
67
67
  args['group'] = group_id unless group_id.nil?
68
68
  args['impersonate'] = impersonate unless impersonate.nil?
69
69
  args['published_since'] = published_since unless published_since.nil?
@@ -363,7 +363,7 @@ module Figshare
363
363
  # @param project_id [Integer] Figshare id of the project
364
364
  # @param article_id [Integer] Figshare id of the article
365
365
  # @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
366
- # @yield [Array] See docs.figshare.com for article hash
366
+ # @yield [Array] See docs.figshare.com
367
367
  def artilce_files(project_id:, article_id:, impersonate: nil, &block)
368
368
  args = {}
369
369
  args['impersonate'] = impersonate unless impersonate.nil?
@@ -36,7 +36,7 @@ module Figshare
36
36
  &block
37
37
  )
38
38
  args = {}
39
- args['institution'] = @institute_id unless institute.nil?
39
+ args['institution'] = @institute_id.to_i if institute
40
40
  args['group_id'] = group_id unless group_id.nil? # Not sure if this should be 'group' or 'group_id'. API has conflicting info
41
41
  args['item_type'] = item_type unless item_type.nil?
42
42
  args['resource_doi'] = resource_doi unless resource_doi.nil?
@@ -80,7 +80,7 @@ module Figshare
80
80
  &block
81
81
  )
82
82
  args = { 'search_for' => search_for }
83
- args['institution'] = @institute_id unless institute.nil?
83
+ args['institution'] = @institute_id.to_i if institute
84
84
  args['group_id'] = group_id unless group_id.nil?
85
85
  args['item_type'] = item_type unless item_type.nil?
86
86
  args['resource_doi'] = resource_doi unless resource_doi.nil?
@@ -4,7 +4,7 @@ module Figshare
4
4
  class PublicCollections < Base
5
5
  # Requests a list of public collections
6
6
  #
7
- # @param institution [Boolean] Just our institution
7
+ # @param institute [Boolean] Just our institution
8
8
  # @param group_id [Integer] Only return this group's collections
9
9
  # @param published_since [Time] Return results if published after this time
10
10
  # @param modified_since [Time] Return results if modified after this time
@@ -18,7 +18,7 @@ module Figshare
18
18
  # @param offset [Numeric] offset is 0 based. Offset and Limit go together
19
19
  # @param limit [Numeric]
20
20
  # @yield [Hash] {id, title, doi, handle, url, published_date}
21
- def list( institution: false,
21
+ def list( institute: false,
22
22
  group_id: nil,
23
23
  published_since: nil,
24
24
  modified_since: nil,
@@ -34,7 +34,7 @@ module Figshare
34
34
  &block
35
35
  )
36
36
  args = {}
37
- args['institution'] = @institute_id unless institution.nil?
37
+ args['institution'] = @institute_id.to_i if institute
38
38
  args['group'] = group_id unless group_id.nil?
39
39
  args['resource_doi'] = resource_doi unless resource_doi.nil?
40
40
  args['doi'] = doi unless doi.nil?
@@ -76,7 +76,7 @@ module Figshare
76
76
  &block
77
77
  )
78
78
  args = { 'search_for' => search_for }
79
- args['institution'] = @institute_id unless institute.nil?
79
+ args['institution'] = @institute_id.to_i if institute
80
80
  args['group_id'] = group_id unless group_id.nil?
81
81
  args['item_type'] = item_type unless item_type.nil?
82
82
  args['resource_doi'] = resource_doi unless resource_doi.nil?
@@ -26,7 +26,7 @@ module Figshare
26
26
  &block
27
27
  )
28
28
  args = {}
29
- args['institution'] = @institute_id unless institute.nil?
29
+ args['institution'] = @institute_id.to_i if institute
30
30
  args['group'] = group_id unless group_id.nil?
31
31
  args['published_since'] = published_since unless published_since.nil?
32
32
  args['order'] = order unless order.nil?
@@ -57,7 +57,7 @@ module Figshare
57
57
  &block
58
58
  )
59
59
  args = { 'search_for' => search_for }
60
- args['institution'] = @institute_id unless institute.nil?
60
+ args['institution'] = @institute_id.to_i if institute
61
61
  args['group'] = group_id unless group_id.nil?
62
62
  args['published_since'] = published_since unless published_since.nil?
63
63
  args['modified_since'] = modified_since unless modified_since.nil?
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.9
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Burrowes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2022-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wikk_json
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.23'
75
+ version: '3.25'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.23'
82
+ version: '3.25'
83
83
  description: |-
84
84
  Figshare version 2 API.
85
85
 
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 3.2.22
139
+ rubygems_version: 3.3.7
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Figshare version 2 API