figshare_api_v2 0.9.4 → 0.9.8
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 +76 -69
- data/lib/figshare_api_v2.rb +37 -32
- 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/stats.rb +6 -2
- data/lib/upload.rb +53 -48
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba08b7f752c1c00d25110a9a35fd774b3f69bd6b6fa902c3bc34f5adb8cb389f
|
4
|
+
data.tar.gz: f8598846eb851fef23c50a8b5e4538cb568bef5f21be3d2ae927509a7230f8da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b005326e07fe1bcbceb20e87b238ae252afaa27dcdf38c6ba0865277510c077446449bc18d0e86652dbe2125bb22795ec39a2bbf659879d2a0b0c3d6cc494c89
|
7
|
+
data.tar.gz: 5814325e0b0ac251024a5487276a0f972fae33e84ab74bf2fe7f91ed74e4b25ef1f19c2e2baa85e158f758be7a4f8a9fb3df4a3db8c90075c7cbb81bf0a2b1dd
|
data/History.txt
CHANGED
@@ -1,3 +1,53 @@
|
|
1
|
+
robertburrowes Tue Nov 2 14:49:47 2021 +1300
|
2
|
+
hr upload is post, not put
|
3
|
+
robertburrowes Tue Nov 2 13:12:30 2021 +1300
|
4
|
+
Saner initialization option :)
|
5
|
+
robertburrowes Tue Sep 21 13:03:44 2021 +1200
|
6
|
+
Experimenting with fetching user accounts. Finding a 9000 limit on the total responses, resulting in odd differences in the numbers between fetching everyone, just active, and just inactive accounts. None of which match using the figshare admin web pages
|
7
|
+
robertburrowes Tue Sep 21 13:01:16 2021 +1200
|
8
|
+
Rubocop'd
|
9
|
+
robertburrowes Tue Sep 21 13:00:57 2021 +1200
|
10
|
+
Rubocop'd Added chdir, so Atom starts in the right dir
|
11
|
+
robertburrowes Mon Sep 20 12:31:26 2021 +1200
|
12
|
+
Test for listing all institutional accounts, and getting individual account quota.
|
13
|
+
robertburrowes Mon Sep 20 12:30:34 2021 +1200
|
14
|
+
Ran through Rubocop to clean up formatting, picking up a few error in quote usage; extra args; and other misc errors.
|
15
|
+
robertburrowes Thu Sep 2 16:26:24 2021 +1200
|
16
|
+
Reserve DOIs
|
17
|
+
robertburrowes Thu Sep 2 16:22:36 2021 +1200
|
18
|
+
Reworked, to check if articles already exist and to reserve DOIs.
|
19
|
+
robertburrowes Thu Sep 2 16:20:53 2021 +1200
|
20
|
+
Look for duplicate files in the source directories.
|
21
|
+
robertburrowes Thu Sep 2 16:17:02 2021 +1200
|
22
|
+
Fetch article IDs, if the conf file has them set to 0
|
23
|
+
robertburrowes Sat Apr 24 09:17:14 2021 +1200
|
24
|
+
check local dir against figshare
|
25
|
+
robertburrowes Thu Apr 22 12:31:17 2021 +1200
|
26
|
+
exclude sub test dir
|
27
|
+
robertburrowes Thu Apr 22 12:31:06 2021 +1200
|
28
|
+
missing ,
|
29
|
+
robertburrowes Thu Apr 22 12:30:49 2021 +1200
|
30
|
+
delete tmp test scripts
|
31
|
+
robertburrowes Fri Mar 19 13:54:58 2021 +1300
|
32
|
+
tests of creation of articles, and upload, using config file
|
33
|
+
robertburrowes Fri Mar 19 13:54:18 2021 +1300
|
34
|
+
Iterate across just last upload
|
35
|
+
robertburrowes Fri Mar 19 13:51:08 2021 +1300
|
36
|
+
Look for duplicate files within upload set, as defined by upload config file
|
37
|
+
robertburrowes Fri Mar 19 13:26:46 2021 +1300
|
38
|
+
hash to json naming changes
|
39
|
+
robertburrowes Fri Mar 19 13:24:00 2021 +1300
|
40
|
+
changes from hash to json naming
|
41
|
+
robertburrowes Fri Mar 19 13:17:26 2021 +1300
|
42
|
+
run from json config file, to test this works
|
43
|
+
robertburrowes Fri Mar 19 13:15:52 2021 +1300
|
44
|
+
Creating generic upload, that uses json config
|
45
|
+
robertburrowes Thu Mar 18 11:59:15 2021 +1300
|
46
|
+
Testing with Peter and Danes articles
|
47
|
+
robertburrowes Tue Mar 16 14:08:00 2021 +1300
|
48
|
+
private articles create was broken: Added private article body method
|
49
|
+
robertburrowes Tue Dec 1 14:43:50 2020 +1300
|
50
|
+
more testing
|
1
51
|
robertburrowes Tue Dec 1 13:19:01 2020 +1300
|
2
52
|
bump build version
|
3
53
|
robertburrowes Tue Dec 1 13:18:27 2020 +1300
|
data/lib/authors.rb
CHANGED
@@ -12,23 +12,27 @@ module Figshare
|
|
12
12
|
# @param order [String] "published_date" Default, "modified_date", "views", "cites", "shares"
|
13
13
|
# @param order_direction [String] "desc" Default, "asc"
|
14
14
|
# @yield [Hash] {id, first_name, last_name, full_name, url_name, is_active, is_public, orcid_id, institution_id, group_id, job_title}
|
15
|
-
def search(
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def search( search_for:,
|
16
|
+
institute: false,
|
17
|
+
group_id: nil,
|
18
|
+
orcid: nil,
|
19
|
+
is_active: true,
|
20
|
+
is_public: true,
|
21
|
+
order: 'published_date',
|
22
|
+
order_direction: 'desc',
|
19
23
|
&block
|
20
24
|
)
|
21
25
|
args = { 'search_for' => search_for }
|
22
|
-
args['institution'] = @institute_id
|
23
|
-
args['group_id'] = group_id
|
24
|
-
args['is_active'] = is_active
|
25
|
-
args['is_public'] = is_public
|
26
|
-
args['orcid'] = orcid
|
27
|
-
args['order'] = order
|
28
|
-
args['order_direction'] = order_direction
|
26
|
+
args['institution'] = @institute_id unless institute.nil?
|
27
|
+
args['group_id'] = group_id unless group_id.nil?
|
28
|
+
args['is_active'] = is_active unless is_active.nil?
|
29
|
+
args['is_public'] = is_public unless is_public.nil?
|
30
|
+
args['orcid'] = orcid unless orcid.nil?
|
31
|
+
args['order'] = order unless order.nil?
|
32
|
+
args['order_direction'] = order_direction unless order_direction.nil?
|
29
33
|
post(api_query: 'account/authors/search', args: args, &block)
|
30
34
|
end
|
31
|
-
|
35
|
+
|
32
36
|
# Get an authors details
|
33
37
|
#
|
34
38
|
# @param author_id [Integer] Figshare Author ID
|
@@ -37,5 +41,4 @@ module Figshare
|
|
37
41
|
get(api_query: "account/authors/#{author_id}", &block)
|
38
42
|
end
|
39
43
|
end
|
40
|
-
|
41
44
|
end
|
data/lib/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module Figshare
|
1
|
+
module Figshare
|
2
2
|
# Supporting web calls to the API
|
3
3
|
#
|
4
4
|
class Base
|
@@ -8,23 +8,30 @@ module Figshare
|
|
8
8
|
attr_accessor :hostname
|
9
9
|
attr_accessor :api_url
|
10
10
|
attr_accessor :institute_id
|
11
|
-
|
11
|
+
|
12
12
|
# Init reads the Json configuration files, setting @course_codes_to_faculty and @academic_department_code_to_faculty
|
13
13
|
# Opens a connection to the LDAP server, setting @ldap for other methods to use.
|
14
14
|
#
|
15
15
|
# @param figshare_user [String] figshare user, in the figshare_keys.json
|
16
|
-
# @param conf_dir [String] directory for figshare_keys.json and figshare_site_params.json
|
17
|
-
|
18
|
-
|
16
|
+
# @param conf_dir [String|nil] directory for figshare_keys.json and figshare_site_params.json
|
17
|
+
# @param key_file [String|nil] conf_dir/figshare_keys.json if nil
|
18
|
+
# @param conf_file [String|nil] conf_dir/figshare_site_params.json if nil
|
19
|
+
def initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil)
|
20
|
+
raise 'Figshare_api_v2.initialize: Need to specify the conf_dir if key_file or conf_file are nil' if conf_dir.nil? && (key_file.nil? || conf_file.nil?)
|
21
|
+
|
22
|
+
conf_file ||= "#{conf_dir}/figshare_site_params.json"
|
23
|
+
key_file ||= "#{conf_dir}/figshare_keys.json"
|
24
|
+
|
25
|
+
figshare_token = load_json_file(key_file)
|
19
26
|
@auth_token = figshare_token[figshare_user]
|
20
|
-
|
21
|
-
figshare_site_params = load_json_file(
|
22
|
-
|
27
|
+
|
28
|
+
figshare_site_params = load_json_file(conf_file)
|
29
|
+
|
23
30
|
@hostname = figshare_site_params['host']
|
24
31
|
@api_url = figshare_site_params['api_url']
|
25
32
|
@institute_id = figshare_site_params['institute_id']
|
26
33
|
end
|
27
|
-
|
34
|
+
|
28
35
|
# Parse the config file
|
29
36
|
#
|
30
37
|
# @param filename [String] config file name to parse
|
@@ -32,7 +39,7 @@ module Figshare
|
|
32
39
|
private def load_json_file(filename)
|
33
40
|
JSON.parse(File.read(filename))
|
34
41
|
end
|
35
|
-
|
42
|
+
|
36
43
|
# get iterates through the API response, yielding each value to the passed block
|
37
44
|
# When Figshare API usually has no paging option.
|
38
45
|
# If there is no block, then the results are printed (useful for debugging)
|
@@ -67,16 +74,16 @@ module Figshare
|
|
67
74
|
private def get_paginate(api_query:, args: {}, debug: false, by_offset: false, &block)
|
68
75
|
args = {} if args.nil?
|
69
76
|
if ! args.is_a?(Hash)
|
70
|
-
|
77
|
+
raise 'get_paginate(): Expecting args to be a Hash'
|
71
78
|
end
|
72
|
-
|
79
|
+
|
73
80
|
offset = 0
|
74
81
|
page = 1
|
75
82
|
limit = page_size = 100
|
76
83
|
result_count = 0
|
77
84
|
loop do
|
78
85
|
content_type = response = nil
|
79
|
-
form_args = by_offset ? {
|
86
|
+
form_args = by_offset ? { 'limit' => limit, 'offset' => offset } : { 'page_size' => page_size, 'page' => page }
|
80
87
|
WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
|
81
88
|
response = ws.get_page( query: "#{@api_url}#{api_query}",
|
82
89
|
authorization: "token #{@auth_token}",
|
@@ -88,10 +95,10 @@ module Figshare
|
|
88
95
|
result_count += page_count
|
89
96
|
break if page_count < page_size # Got less results than we asked for, so it was the last page
|
90
97
|
|
91
|
-
page += 1 #Ready to fetch next page
|
92
|
-
offset += limit #if we use offset, then mor
|
98
|
+
page += 1 # Ready to fetch next page
|
99
|
+
offset += limit # if we use offset, then mor
|
93
100
|
end
|
94
|
-
|
101
|
+
|
95
102
|
return result_count
|
96
103
|
end
|
97
104
|
|
@@ -105,26 +112,26 @@ module Figshare
|
|
105
112
|
# @param content_type [String] Assuming Json, but might need binary ('application/octet-stream')
|
106
113
|
# @yield [String] if given a block, iterates through the result from figshare
|
107
114
|
# @return [Integer] number of results.
|
108
|
-
private def post(api_query:, args: {}, data: nil, debug: false, content_type: 'application/json; charset=UTF-8', &block)
|
115
|
+
private def post(api_query:, args: {}, data: nil, debug: false, content_type: 'application/json; charset=UTF-8', &block)
|
109
116
|
body = nil
|
110
|
-
if data.is_a?(Hash)
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
body = if data.is_a?(Hash)
|
118
|
+
# Convert hash to json, and merge in additional args
|
119
|
+
data.merge(args).to_j
|
120
|
+
elsif data.nil? && ! args.empty?
|
121
|
+
# No data, but args, so just use the args
|
122
|
+
args.to_j
|
123
|
+
else
|
124
|
+
# Data isn't a Hash, so just pass it through (might be nil)
|
125
|
+
data
|
126
|
+
end
|
127
|
+
|
128
|
+
response = nil
|
122
129
|
WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
|
123
130
|
response = ws.post_page( query: "#{@api_url}#{api_query}",
|
124
131
|
content_type: content_type,
|
125
132
|
authorization: "token #{@auth_token}",
|
126
133
|
data: body
|
127
|
-
|
134
|
+
)
|
128
135
|
content_type = ws.header_value(key: 'Content-Type')
|
129
136
|
end
|
130
137
|
return iterate_json_response(response: response, content_type: content_type, debug: debug, &block)
|
@@ -140,34 +147,34 @@ module Figshare
|
|
140
147
|
# @param by_offset [Boolean] use offset/limit rather than page/page_size in API calls
|
141
148
|
# @yield [String] if given a block, iterates through the result from figshare
|
142
149
|
# @return [Integer] number of results.
|
143
|
-
private def post_paginate(api_query:, args: {}, debug: false, by_offset: false,
|
150
|
+
private def post_paginate(api_query:, args: {}, debug: false, by_offset: false, &block)
|
144
151
|
page = 1
|
145
152
|
offset = 0
|
146
153
|
limit = page_size = 100
|
147
154
|
result_count = 0
|
148
|
-
|
155
|
+
|
149
156
|
args = {} if args.nil?
|
150
157
|
if ! args.is_a?(Hash)
|
151
|
-
|
158
|
+
raise 'post_paginate(): Expecting args to be a Hash'
|
152
159
|
end
|
153
|
-
|
160
|
+
|
154
161
|
loop do
|
155
162
|
content_type = response = nil
|
156
|
-
form_args = by_offset ? {
|
163
|
+
form_args = by_offset ? { 'limit' => limit, 'offset' => offset } : { 'page_size' => page_size, 'page' => page }
|
157
164
|
WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
|
158
165
|
response = ws.post_page( query: "#{@api_url}#{api_query}",
|
159
166
|
content_type: 'application/json; charset=UTF-8',
|
160
167
|
authorization: "token #{@auth_token}",
|
161
168
|
data: args.merge(form_args).to_j
|
162
|
-
|
169
|
+
)
|
163
170
|
content_type = ws.header_value(key: 'Content-Type')
|
164
171
|
end
|
165
172
|
page_count = iterate_json_response(response: response, content_type: content_type, debug: debug, &block)
|
166
173
|
result_count += page_count
|
167
174
|
break if page_count < page_size # Got less results than we asked for, so it was the last page
|
168
175
|
|
169
|
-
page += 1 #Ready to fetch next page
|
170
|
-
offset += limit #if we use offset
|
176
|
+
page += 1 # Ready to fetch next page
|
177
|
+
offset += limit # if we use offset
|
171
178
|
end
|
172
179
|
return result_count
|
173
180
|
end
|
@@ -181,27 +188,27 @@ module Figshare
|
|
181
188
|
# @param debug [Boolean] print result to stdout
|
182
189
|
# @param content_type [String] Assuming Json, but might need binary ('application/octet-stream')
|
183
190
|
# @yield [String] if given a block, iterates through the result from figshare
|
184
|
-
# @return [Integer] number of results
|
191
|
+
# @return [Integer] number of results
|
185
192
|
private def put(api_query:, args: {}, data: nil, debug: false, content_type: 'application/json; charset=UTF-8', &block)
|
186
193
|
body = nil
|
187
|
-
if data.is_a?(Hash)
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
194
|
+
body = if data.is_a?(Hash)
|
195
|
+
# Convert hash to json, and merge in additional args
|
196
|
+
data.merge(args).to_j
|
197
|
+
elsif data.nil? && ! args.empty?
|
198
|
+
# No data, but args, so just use the args
|
199
|
+
args.to_j
|
200
|
+
else
|
201
|
+
# Data isn't a Hash, so just pass it through (might be nil)
|
202
|
+
data
|
203
|
+
end
|
197
204
|
|
198
|
-
|
205
|
+
response = nil
|
199
206
|
WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
|
200
|
-
response = ws.
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
207
|
+
response = ws.put_req( query: "#{@api_url}#{api_query}",
|
208
|
+
content_type: content_type,
|
209
|
+
authorization: "token #{@auth_token}",
|
210
|
+
data: body
|
211
|
+
)
|
205
212
|
content_type = ws.header_value(key: 'Content-Type')
|
206
213
|
end
|
207
214
|
return iterate_json_response(response: response, content_type: content_type, debug: debug, &block)
|
@@ -214,18 +221,18 @@ module Figshare
|
|
214
221
|
# @param debug [Boolean] print result to stdout
|
215
222
|
# @yield [Hash] Unlikely to have a result from delete calls, but if we do, we see it here
|
216
223
|
# @return [Integer] number of results (usually 0)
|
217
|
-
private def delete(api_query:, args: {}, debug: false, &block)
|
218
|
-
|
219
|
-
content_type = response = nil
|
224
|
+
private def delete(api_query:, args: {}, debug: false, content_type: 'application/json; charset=UTF-8', &block)
|
225
|
+
response = nil
|
220
226
|
WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
|
221
227
|
response = ws.delete_req( query: "#{@api_url}#{api_query}",
|
222
|
-
|
223
|
-
|
228
|
+
authorization: "token #{@auth_token}",
|
229
|
+
form_values: args
|
230
|
+
)
|
224
231
|
content_type = ws.header_value(key: 'Content-Type')
|
225
232
|
end
|
226
233
|
return iterate_json_response(response: response, content_type: content_type, debug: debug, &block)
|
227
234
|
end
|
228
|
-
|
235
|
+
|
229
236
|
# For iterate through the api response
|
230
237
|
#
|
231
238
|
# @param response [String] response from the API call
|
@@ -234,25 +241,25 @@ module Figshare
|
|
234
241
|
# @yield [Hash] each array member in the response (or the entire response, if not iteratable)
|
235
242
|
private def iterate_json_response(response:, content_type:, debug: false )
|
236
243
|
return 0 if response.nil? # got no responses
|
237
|
-
|
244
|
+
|
238
245
|
if content_type =~ /application\/json/
|
239
246
|
response_array = JSON.parse(response)
|
240
|
-
#If we don't have an Array, turn the response into an Array so we can iterate over this one response.
|
241
|
-
response_array = [ response_array ]
|
247
|
+
# If we don't have an Array, turn the response into an Array so we can iterate over this one response.
|
248
|
+
response_array = [ response_array ] unless response_array.instance_of?(Array)
|
242
249
|
return 0 if response_array.empty? # got empty array of responses
|
243
|
-
|
250
|
+
|
244
251
|
count = 0
|
245
252
|
response_array.each do |r|
|
246
253
|
yield r if block_given?
|
247
254
|
p r if debug
|
248
255
|
count += 1
|
249
256
|
end
|
250
|
-
|
257
|
+
|
251
258
|
return count
|
252
|
-
else #just dump the entire response on the caller :)
|
253
|
-
yield response
|
259
|
+
else # just dump the entire response on the caller :)
|
260
|
+
yield response if block_given?
|
254
261
|
return response.length
|
255
262
|
end
|
256
263
|
end
|
257
264
|
end
|
258
|
-
end
|
265
|
+
end
|
data/lib/figshare_api_v2.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
module Figshare
|
2
|
-
|
1
|
+
module Figshare # :nodoc:
|
2
|
+
# Figshare module initialization
|
3
|
+
#
|
4
|
+
VERSION = '0.9.8'
|
3
5
|
|
4
|
-
require
|
5
|
-
require
|
6
|
+
require 'wikk_webbrowser'
|
7
|
+
require 'wikk_json'
|
6
8
|
require 'time'
|
7
9
|
|
8
10
|
require_relative 'base.rb'
|
@@ -18,8 +20,8 @@ module Figshare
|
|
18
20
|
require_relative 'upload.rb'
|
19
21
|
require_relative 'stats.rb'
|
20
22
|
require_relative 'oai_pmh.rb'
|
21
|
-
|
22
|
-
#
|
23
|
+
|
24
|
+
# HACK: to do a lazy initialization of the Figshare subclasses. i.e. only if they get called.
|
23
25
|
# Usage:
|
24
26
|
# @figshare = Figshare::Init.new(figshare_user: 'figshare_admin', conf_dir: "#{__dir__}/conf")
|
25
27
|
#
|
@@ -31,95 +33,98 @@ module Figshare
|
|
31
33
|
# Intitialize the Init class, so it can dynamically initialize the Figshare subclasses
|
32
34
|
#
|
33
35
|
# @param figshare_user [String] figshare user, in the figshare_keys.json
|
34
|
-
# @param conf_dir [String] directory for figshare_keys.json and figshare_site_params.json
|
35
|
-
|
36
|
+
# @param conf_dir [String|nil] directory for figshare_keys.json and figshare_site_params.json
|
37
|
+
# @param key_file [String|nil] conf_dir/figshare_keys.json if nil
|
38
|
+
# @param conf_file [String|nil] conf_dir/figshare_site_params.json if nil
|
39
|
+
def initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil)
|
36
40
|
@figshare_user = figshare_user
|
37
41
|
@conf_dir = conf_dir
|
42
|
+
@key_file = key_file
|
43
|
+
@conf_file = conf_file
|
38
44
|
end
|
39
|
-
|
45
|
+
|
40
46
|
# Create Figshare::Authors, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
41
47
|
#
|
42
48
|
# @return [Figshare::Authors]
|
43
49
|
def authors
|
44
|
-
@authors ||= Authors.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
50
|
+
@authors ||= Authors.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
45
51
|
end
|
46
52
|
|
47
53
|
# Create Figshare::Institutions, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
48
54
|
#
|
49
55
|
# @return [Figshare::Institutions]
|
50
56
|
def institutions
|
51
|
-
@institutions ||= Institutions.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
57
|
+
@institutions ||= Institutions.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
52
58
|
end
|
53
|
-
|
59
|
+
|
54
60
|
# Create Figshare::Other, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
55
61
|
#
|
56
62
|
# @return [Figshare::Other]
|
57
63
|
def other
|
58
|
-
@other ||= Other.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
64
|
+
@other ||= Other.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
59
65
|
end
|
60
|
-
|
66
|
+
|
61
67
|
# Create Figshare::PrivateArticles, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
62
68
|
#
|
63
69
|
# @return [Figshare::PrivateArticles]
|
64
70
|
def private_articles
|
65
|
-
@private_articles ||= PrivateArticles.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
71
|
+
@private_articles ||= PrivateArticles.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
66
72
|
end
|
67
|
-
|
73
|
+
|
68
74
|
# Create Figshare::PrivateCollections, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
69
75
|
#
|
70
76
|
# @return [Figshare::PrivateCollections]
|
71
77
|
def private_collections
|
72
|
-
@private_collections ||= PrivateCollections.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
78
|
+
@private_collections ||= PrivateCollections.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
73
79
|
end
|
74
|
-
|
80
|
+
|
75
81
|
# Create Figshare::PrivateProjects, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
76
82
|
#
|
77
83
|
# @return [Figshare::PrivateProjects]
|
78
84
|
def private_projects
|
79
|
-
@private_projects ||= PrivateProjects.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
85
|
+
@private_projects ||= PrivateProjects.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
80
86
|
end
|
81
|
-
|
87
|
+
|
82
88
|
# Create Figshare::PublicArticles, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
83
89
|
#
|
84
90
|
# @return [Figshare::PublicArticles]
|
85
91
|
def public_articles
|
86
|
-
@public_articles ||= PublicArticles.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
92
|
+
@public_articles ||= PublicArticles.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
87
93
|
end
|
88
|
-
|
94
|
+
|
89
95
|
# Create Figshare::PublicCollections, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
90
96
|
#
|
91
97
|
# @return [Figshare::PublicCollections]
|
92
98
|
def public_collections
|
93
|
-
@public_collections ||= PublicCollections.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
99
|
+
@public_collections ||= PublicCollections.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
94
100
|
end
|
95
|
-
|
101
|
+
|
96
102
|
# Create Figshare::PublicProjects, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
97
103
|
#
|
98
104
|
# @return [Figshare::PublicProjects]
|
99
105
|
def public_projects
|
100
|
-
@public_projects ||= PublicProjects.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
106
|
+
@public_projects ||= PublicProjects.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
101
107
|
end
|
102
108
|
|
103
109
|
# Create Figshare::Upload, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
104
110
|
#
|
105
111
|
# @return [Figshare::Upload]
|
106
112
|
def upload
|
107
|
-
@upload ||= Upload.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
113
|
+
@upload ||= Upload.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
108
114
|
end
|
109
|
-
|
115
|
+
|
110
116
|
# Create Figshare::Stats, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
111
117
|
#
|
112
118
|
# @return [Figshare::Stats]
|
113
119
|
def stats
|
114
|
-
@stats ||= Stats.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
120
|
+
@stats ||= Stats.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
115
121
|
end
|
116
|
-
|
122
|
+
|
117
123
|
# Create Figshare::OAI_PMH, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
118
124
|
#
|
119
125
|
# @return [Figshare::OAI_PMH]
|
120
126
|
def oai_pmh
|
121
|
-
@oai_pmh ||= OAI_PMH.new(figshare_user: @figshare_user, conf_dir: @conf_dir)
|
127
|
+
@oai_pmh ||= OAI_PMH.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file)
|
122
128
|
end
|
123
|
-
|
124
129
|
end
|
125
|
-
end
|
130
|
+
end
|