figshare_api_v2 0.9.3 → 0.9.7

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: 259b03e95b270260852cc86ec85c113f18ecb7c05f99dcf16963887b23b152d6
4
- data.tar.gz: a0f417988d2aa83790eb18d7a65083d597a89205babed4adf6568624f76d0b89
3
+ metadata.gz: a86e2853e1c2c18bf91ac4c3bd5052969bdf6924ea5fb3c7e89c47e6b3269c17
4
+ data.tar.gz: 4a27f7e8c20b0e9bbdc6227b7f0a0d85ab68f66e8ff8870c9d62754976dddc12
5
5
  SHA512:
6
- metadata.gz: fa89b80dfcc714c3cff069c82351860680fe182fa4f1c833d99503696968be2cff1c60f440c4b04895ee65fd88beae696f3b6a260c766788570cc1a21730ec5e
7
- data.tar.gz: 25e7b0ad0a2f171dd0c4dbacc76451bbdd05e465713beb67f07dfcc22fe9211f3a64bae10433d68ca48c89875beece3924aba96efc2d680cb7319f336c27ee8a
6
+ metadata.gz: dc319835c9ce246e14d9b221bff575af8aa05b70e782b12d674b17f858ff2cfd309f1535ca0e371dea3f5ce23b33d26d64721dd786eb2085cde995aa213d370d
7
+ data.tar.gz: '01970e2696c5a5f969463d38446a7a658e12f0e8cabad2704fc5fb00202058891ef7748d5993540e7da24da6ebea4081f8322917493141bd491329608c98800a'
data/History.txt CHANGED
@@ -1,3 +1,59 @@
1
+ robertburrowes Tue Nov 2 13:12:30 2021 +1300
2
+ Saner initialization option :)
3
+ robertburrowes Tue Sep 21 13:03:44 2021 +1200
4
+ 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
5
+ robertburrowes Tue Sep 21 13:01:16 2021 +1200
6
+ Rubocop'd
7
+ robertburrowes Tue Sep 21 13:00:57 2021 +1200
8
+ Rubocop'd Added chdir, so Atom starts in the right dir
9
+ robertburrowes Mon Sep 20 12:31:26 2021 +1200
10
+ Test for listing all institutional accounts, and getting individual account quota.
11
+ robertburrowes Mon Sep 20 12:30:34 2021 +1200
12
+ Ran through Rubocop to clean up formatting, picking up a few error in quote usage; extra args; and other misc errors.
13
+ robertburrowes Thu Sep 2 16:26:24 2021 +1200
14
+ Reserve DOIs
15
+ robertburrowes Thu Sep 2 16:22:36 2021 +1200
16
+ Reworked, to check if articles already exist and to reserve DOIs.
17
+ robertburrowes Thu Sep 2 16:20:53 2021 +1200
18
+ Look for duplicate files in the source directories.
19
+ robertburrowes Thu Sep 2 16:17:02 2021 +1200
20
+ Fetch article IDs, if the conf file has them set to 0
21
+ robertburrowes Sat Apr 24 09:17:14 2021 +1200
22
+ check local dir against figshare
23
+ robertburrowes Thu Apr 22 12:31:17 2021 +1200
24
+ exclude sub test dir
25
+ robertburrowes Thu Apr 22 12:31:06 2021 +1200
26
+ missing ,
27
+ robertburrowes Thu Apr 22 12:30:49 2021 +1200
28
+ delete tmp test scripts
29
+ robertburrowes Fri Mar 19 13:54:58 2021 +1300
30
+ tests of creation of articles, and upload, using config file
31
+ robertburrowes Fri Mar 19 13:54:18 2021 +1300
32
+ Iterate across just last upload
33
+ robertburrowes Fri Mar 19 13:51:08 2021 +1300
34
+ Look for duplicate files within upload set, as defined by upload config file
35
+ robertburrowes Fri Mar 19 13:26:46 2021 +1300
36
+ hash to json naming changes
37
+ robertburrowes Fri Mar 19 13:24:00 2021 +1300
38
+ changes from hash to json naming
39
+ robertburrowes Fri Mar 19 13:17:26 2021 +1300
40
+ run from json config file, to test this works
41
+ robertburrowes Fri Mar 19 13:15:52 2021 +1300
42
+ Creating generic upload, that uses json config
43
+ robertburrowes Thu Mar 18 11:59:15 2021 +1300
44
+ Testing with Peter and Danes articles
45
+ robertburrowes Tue Mar 16 14:08:00 2021 +1300
46
+ private articles create was broken: Added private article body method
47
+ robertburrowes Tue Dec 1 14:43:50 2020 +1300
48
+ more testing
49
+ robertburrowes Tue Dec 1 13:19:01 2020 +1300
50
+ bump build version
51
+ robertburrowes Tue Dec 1 13:18:27 2020 +1300
52
+ Shouldn't have had article_id in URL
53
+ robertburrowes Tue Dec 1 13:18:06 2020 +1300
54
+ More random tests
55
+ robertburrowes Tue Dec 1 13:17:40 2020 +1300
56
+ ignore test
1
57
  robertburrowes Mon Nov 9 22:35:19 2020 +1300
2
58
  Missed @ in trace
3
59
  robertburrowes Mon Nov 9 22:27:11 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(institute: false, group_id: nil, orcid: nil,
16
- is_active: true, is_public: true,
17
- order: 'published_date', order_direction: 'desc',
18
- search_for:,
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 if ! institute.nil?
23
- args['group_id'] = group_id if ! group_id.nil?
24
- args['is_active'] = is_active if ! is_active.nil?
25
- args['is_public'] = is_public if ! is_public.nil?
26
- args['orcid'] = orcid if ! orcid.nil?
27
- args['order'] = order if ! order.nil?
28
- args['order_direction'] = order_direction if ! order_direction.nil?
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
- def initialize(figshare_user:, conf_dir:)
18
- figshare_token = load_json_file("#{conf_dir}/figshare_keys.json")
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("#{conf_dir}/figshare_site_params.json")
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
- raise "get_paginate(): Expecting args to be a Hash"
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 ? {"limit"=>limit, "offset"=>offset} : {"page_size"=>page_size, "page"=>page}
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
- # Convert hash to json, and merge in additional args
112
- body = data.merge(args).to_j
113
- elsif data.nil? && ! args.empty?
114
- # No data, but args, so just use the args
115
- body = args.to_j
116
- else
117
- # Data isn't a Hash, so just pass it through (might be nil)
118
- body = data
119
- end
120
-
121
- content_type = response = nil
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, &block)
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
- raise "post_paginate(): Expecting args to be a Hash"
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 ? {"limit"=>limit, "offset"=>offset} : {"page_size"=>page_size, "page"=>page}
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
- # Convert hash to json, and merge in additional args
189
- body = data.merge(args).to_j
190
- elsif data.nil? && ! args.empty?
191
- # No data, but args, so just use the args
192
- body = args.to_j
193
- else
194
- # Data isn't a Hash, so just pass it through (might be nil)
195
- body = data
196
- end
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
- content_type = response = nil
205
+ response = nil
199
206
  WIKK::WebBrowser.https_session( host: @hostname, verify_cert: false ) do |ws|
200
- response = ws.put_page( query: "#{@api_url}#{api_query}",
201
- content_type: content_type,
202
- authorization: "token #{@auth_token}",
203
- data: body
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
- #ignoring args for the moment. Not sure what to do with them, if we do get them.
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
- authorization: "token #{@auth_token}"
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 ] if ! (response_array.class == 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 if block_given?
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
@@ -1,8 +1,10 @@
1
- module Figshare
2
- VERSION = '0.9.3'
1
+ module Figshare # :nodoc:
2
+ # Figshare module initialization
3
+ #
4
+ VERSION = '0.9.7'
3
5
 
4
- require "wikk_webbrowser"
5
- require "wikk_json"
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
- # Hack :) to do a lazy initialization of the Figshare subclasses. i.e. only if they get called.
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
- def initialize(figshare_user:, conf_dir:)
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 # module
130
+ end