figshare_api_v2 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +8 -0
- data/lib/base.rb +11 -4
- data/lib/figshare_api_v2.rb +19 -15
- data/lib/stats.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a86e2853e1c2c18bf91ac4c3bd5052969bdf6924ea5fb3c7e89c47e6b3269c17
|
4
|
+
data.tar.gz: 4a27f7e8c20b0e9bbdc6227b7f0a0d85ab68f66e8ff8870c9d62754976dddc12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc319835c9ce246e14d9b221bff575af8aa05b70e782b12d674b17f858ff2cfd309f1535ca0e371dea3f5ce23b33d26d64721dd786eb2085cde995aa213d370d
|
7
|
+
data.tar.gz: '01970e2696c5a5f969463d38446a7a658e12f0e8cabad2704fc5fb00202058891ef7748d5993540e7da24da6ebea4081f8322917493141bd491329608c98800a'
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
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
|
1
9
|
robertburrowes Mon Sep 20 12:31:26 2021 +1200
|
2
10
|
Test for listing all institutional accounts, and getting individual account quota.
|
3
11
|
robertburrowes Mon Sep 20 12:30:34 2021 +1200
|
data/lib/base.rb
CHANGED
@@ -13,12 +13,19 @@ module Figshare
|
|
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
27
|
|
21
|
-
figshare_site_params = load_json_file(
|
28
|
+
figshare_site_params = load_json_file(conf_file)
|
22
29
|
|
23
30
|
@hostname = figshare_site_params['host']
|
24
31
|
@api_url = figshare_site_params['api_url']
|
data/lib/figshare_api_v2.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Figshare # :nodoc:
|
2
2
|
# Figshare module initialization
|
3
3
|
#
|
4
|
-
VERSION = '0.9.
|
4
|
+
VERSION = '0.9.7'
|
5
5
|
|
6
6
|
require 'wikk_webbrowser'
|
7
7
|
require 'wikk_json'
|
@@ -33,94 +33,98 @@ module Figshare # :nodoc:
|
|
33
33
|
# Intitialize the Init class, so it can dynamically initialize the Figshare subclasses
|
34
34
|
#
|
35
35
|
# @param figshare_user [String] figshare user, in the figshare_keys.json
|
36
|
-
# @param conf_dir [String] directory for figshare_keys.json and figshare_site_params.json
|
37
|
-
|
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)
|
38
40
|
@figshare_user = figshare_user
|
39
41
|
@conf_dir = conf_dir
|
42
|
+
@key_file = key_file
|
43
|
+
@conf_file = conf_file
|
40
44
|
end
|
41
45
|
|
42
46
|
# Create Figshare::Authors, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
43
47
|
#
|
44
48
|
# @return [Figshare::Authors]
|
45
49
|
def authors
|
46
|
-
@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)
|
47
51
|
end
|
48
52
|
|
49
53
|
# Create Figshare::Institutions, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
50
54
|
#
|
51
55
|
# @return [Figshare::Institutions]
|
52
56
|
def institutions
|
53
|
-
@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)
|
54
58
|
end
|
55
59
|
|
56
60
|
# Create Figshare::Other, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
57
61
|
#
|
58
62
|
# @return [Figshare::Other]
|
59
63
|
def other
|
60
|
-
@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)
|
61
65
|
end
|
62
66
|
|
63
67
|
# Create Figshare::PrivateArticles, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
64
68
|
#
|
65
69
|
# @return [Figshare::PrivateArticles]
|
66
70
|
def private_articles
|
67
|
-
@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)
|
68
72
|
end
|
69
73
|
|
70
74
|
# Create Figshare::PrivateCollections, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
71
75
|
#
|
72
76
|
# @return [Figshare::PrivateCollections]
|
73
77
|
def private_collections
|
74
|
-
@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)
|
75
79
|
end
|
76
80
|
|
77
81
|
# Create Figshare::PrivateProjects, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
78
82
|
#
|
79
83
|
# @return [Figshare::PrivateProjects]
|
80
84
|
def private_projects
|
81
|
-
@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)
|
82
86
|
end
|
83
87
|
|
84
88
|
# Create Figshare::PublicArticles, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
85
89
|
#
|
86
90
|
# @return [Figshare::PublicArticles]
|
87
91
|
def public_articles
|
88
|
-
@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)
|
89
93
|
end
|
90
94
|
|
91
95
|
# Create Figshare::PublicCollections, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
92
96
|
#
|
93
97
|
# @return [Figshare::PublicCollections]
|
94
98
|
def public_collections
|
95
|
-
@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)
|
96
100
|
end
|
97
101
|
|
98
102
|
# Create Figshare::PublicProjects, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
99
103
|
#
|
100
104
|
# @return [Figshare::PublicProjects]
|
101
105
|
def public_projects
|
102
|
-
@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)
|
103
107
|
end
|
104
108
|
|
105
109
|
# Create Figshare::Upload, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
106
110
|
#
|
107
111
|
# @return [Figshare::Upload]
|
108
112
|
def upload
|
109
|
-
@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)
|
110
114
|
end
|
111
115
|
|
112
116
|
# Create Figshare::Stats, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
113
117
|
#
|
114
118
|
# @return [Figshare::Stats]
|
115
119
|
def stats
|
116
|
-
@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)
|
117
121
|
end
|
118
122
|
|
119
123
|
# Create Figshare::OAI_PMH, if it doesn't exist. Initialized with @figshare_user and @conf_dir
|
120
124
|
#
|
121
125
|
# @return [Figshare::OAI_PMH]
|
122
126
|
def oai_pmh
|
123
|
-
@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)
|
124
128
|
end
|
125
129
|
end
|
126
130
|
end
|
data/lib/stats.rb
CHANGED
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Burrowes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wikk_json
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.2.22
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Figshare version 2 API.
|