scholarsphere-client 0.5.2 → 0.5.4
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/.circleci/config.yml +1 -1
- data/.gitignore +1 -0
- data/Gemfile.lock +27 -23
- data/README.md +18 -1
- data/bin/check_dependencies.rb +7 -0
- data/lib/scholarsphere/client/ingest.rb +27 -7
- data/lib/scholarsphere/client/version.rb +1 -1
- data/sample.rb +1 -1
- data/scholarsphere-client.gemspec +4 -4
- metadata +14 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 596dc12ea255cd527a837883dfda00f14608c0a143c1bc45218064b3fc176d19
|
|
4
|
+
data.tar.gz: c7653c11468ef0fb22f62e0252ffa3ccc0f8dd04e7fdcbe99d32bab220ff3da9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a0f97c662b4398d6b537eb38f6245f24fa63c072af9d7583a39a09de5a9ef4e0fcabbb2258b7269b60cd79d8fd2107c1920960a8154ba9f2f486c64dd9bed2d
|
|
7
|
+
data.tar.gz: 2ebc30e313a98e2ab1aa639111a86d1f65d6c8ad694aeec189cdf03af3ac23d87df3e7be0ba428e2746cfd0d7c9629e2934bf3d8c6bba5ade3782feca5f0ad18
|
data/.circleci/config.yml
CHANGED
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
scholarsphere-client (0.5.
|
|
5
|
-
aws-sdk-s3 (~> 1.
|
|
6
|
-
faraday (
|
|
7
|
-
marcel (~> 1.0)
|
|
8
|
-
mutex_m (~> 0.3)
|
|
4
|
+
scholarsphere-client (0.5.4)
|
|
5
|
+
aws-sdk-s3 (~> 1.233.2)
|
|
6
|
+
faraday (~> 2.15.0)
|
|
7
|
+
marcel (~> 2.1.0)
|
|
8
|
+
mutex_m (~> 0.3.0)
|
|
9
9
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
@@ -34,17 +34,20 @@ GEM
|
|
|
34
34
|
ast (2.4.2)
|
|
35
35
|
aws-eventstream (1.3.2)
|
|
36
36
|
aws-partitions (1.1069.0)
|
|
37
|
-
aws-sdk-core (3.
|
|
37
|
+
aws-sdk-core (3.257.0)
|
|
38
38
|
aws-eventstream (~> 1, >= 1.3.0)
|
|
39
39
|
aws-partitions (~> 1, >= 1.992.0)
|
|
40
40
|
aws-sigv4 (~> 1.9)
|
|
41
41
|
base64
|
|
42
|
+
bigdecimal
|
|
42
43
|
jmespath (~> 1, >= 1.6.1)
|
|
44
|
+
logger
|
|
45
|
+
rexml (~> 3.4, >= 3.4.2)
|
|
43
46
|
aws-sdk-kms (1.99.0)
|
|
44
47
|
aws-sdk-core (~> 3, >= 3.216.0)
|
|
45
48
|
aws-sigv4 (~> 1.5)
|
|
46
|
-
aws-sdk-s3 (1.
|
|
47
|
-
aws-sdk-core (~> 3, >= 3.
|
|
49
|
+
aws-sdk-s3 (1.233.2)
|
|
50
|
+
aws-sdk-core (~> 3, >= 3.256.0)
|
|
48
51
|
aws-sdk-kms (~> 1)
|
|
49
52
|
aws-sigv4 (~> 1.5)
|
|
50
53
|
aws-sigv4 (1.11.0)
|
|
@@ -80,15 +83,12 @@ GEM
|
|
|
80
83
|
rubocop (>= 1)
|
|
81
84
|
smart_properties
|
|
82
85
|
erubi (1.13.1)
|
|
83
|
-
faraday (
|
|
84
|
-
faraday-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
faraday-excon (1.1.0)
|
|
90
|
-
faraday-net_http (1.0.1)
|
|
91
|
-
faraday-net_http_persistent (1.1.0)
|
|
86
|
+
faraday (2.15.0)
|
|
87
|
+
faraday-net_http (>= 2.0, < 3.6)
|
|
88
|
+
json
|
|
89
|
+
logger
|
|
90
|
+
faraday-net_http (3.5.0)
|
|
91
|
+
net-http (~> 0.5)
|
|
92
92
|
ffi (1.17.1)
|
|
93
93
|
hashdiff (1.1.2)
|
|
94
94
|
i18n (1.14.7)
|
|
@@ -101,12 +101,16 @@ GEM
|
|
|
101
101
|
loofah (2.24.1)
|
|
102
102
|
crass (~> 1.0.2)
|
|
103
103
|
nokogiri (>= 1.12.0)
|
|
104
|
-
marcel (1.0
|
|
104
|
+
marcel (2.1.0)
|
|
105
105
|
method_source (1.1.0)
|
|
106
106
|
mini_portile2 (2.8.9)
|
|
107
107
|
minitest (5.25.5)
|
|
108
|
-
multipart-post (2.1.1)
|
|
109
108
|
mutex_m (0.3.0)
|
|
109
|
+
net-http (0.10.0)
|
|
110
|
+
net-protocol (>= 0.3.0)
|
|
111
|
+
uri (>= 0.11.1)
|
|
112
|
+
net-protocol (0.4.0)
|
|
113
|
+
timeout
|
|
110
114
|
niftany (0.12.0)
|
|
111
115
|
colorize (~> 1.1.0)
|
|
112
116
|
erb_lint (~> 0.9.0)
|
|
@@ -118,7 +122,7 @@ GEM
|
|
|
118
122
|
rubocop-rspec (~> 3.5)
|
|
119
123
|
rubocop-rspec_rails (~> 2.30)
|
|
120
124
|
scss_lint (~> 0.60)
|
|
121
|
-
nokogiri (1.
|
|
125
|
+
nokogiri (1.19.4)
|
|
122
126
|
mini_portile2 (~> 2.8.2)
|
|
123
127
|
racc (~> 1.4)
|
|
124
128
|
parallel (1.26.3)
|
|
@@ -133,7 +137,7 @@ GEM
|
|
|
133
137
|
pry (>= 0.13, < 0.15)
|
|
134
138
|
public_suffix (6.0.1)
|
|
135
139
|
racc (1.8.1)
|
|
136
|
-
rack (3.2.
|
|
140
|
+
rack (3.2.7)
|
|
137
141
|
rails-dom-testing (2.3.0)
|
|
138
142
|
activesupport (>= 5.0.0)
|
|
139
143
|
minitest
|
|
@@ -201,7 +205,6 @@ GEM
|
|
|
201
205
|
rubocop (~> 1.72, >= 1.72.1)
|
|
202
206
|
rubocop-rspec (~> 3.5)
|
|
203
207
|
ruby-progressbar (1.13.0)
|
|
204
|
-
ruby2_keywords (0.0.4)
|
|
205
208
|
sass (3.7.4)
|
|
206
209
|
sass-listen (~> 4.0.0)
|
|
207
210
|
sass-listen (4.0.0)
|
|
@@ -217,12 +220,13 @@ GEM
|
|
|
217
220
|
simplecov-html (0.13.2)
|
|
218
221
|
simplecov_json_formatter (0.1.4)
|
|
219
222
|
smart_properties (1.17.0)
|
|
223
|
+
timeout (0.6.1)
|
|
220
224
|
tzinfo (2.0.6)
|
|
221
225
|
concurrent-ruby (~> 1.0)
|
|
222
226
|
unicode-display_width (3.1.4)
|
|
223
227
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
224
228
|
unicode-emoji (4.0.4)
|
|
225
|
-
uri (1.
|
|
229
|
+
uri (1.1.2)
|
|
226
230
|
vcr (6.0.0)
|
|
227
231
|
webmock (3.25.1)
|
|
228
232
|
addressable (>= 2.8.0)
|
data/README.md
CHANGED
|
@@ -61,7 +61,7 @@ ingest = Scholarsphere::Client::Ingest.new(
|
|
|
61
61
|
depositor: 'axb123'
|
|
62
62
|
)
|
|
63
63
|
|
|
64
|
-
response = ingest.
|
|
64
|
+
response = ingest.create
|
|
65
65
|
|
|
66
66
|
puts response.body
|
|
67
67
|
```
|
|
@@ -73,6 +73,23 @@ The json output should look like:
|
|
|
73
73
|
"url": "/resources/0797e99c-7d4f-4e05-8bf6-86aea1029a6a"
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
If you pass in "publish:false", the json should also contain an edit_url that links to the file upload page.
|
|
77
|
+
|
|
78
|
+
ingest = Scholarsphere::Client::Ingest.new(
|
|
79
|
+
metadata: metadata,
|
|
80
|
+
files: files,
|
|
81
|
+
depositor: 'axb123',
|
|
82
|
+
publish: false
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
response = ingest.create
|
|
86
|
+
|
|
87
|
+
Returns json:
|
|
88
|
+
{
|
|
89
|
+
"message": "Work was successfully created",
|
|
90
|
+
"url": "/resources/0797e99c-7d4f-4e05-8bf6-86aea1029a6a",
|
|
91
|
+
"edit_url": "/dashboard/form/work_versions/8/files"
|
|
92
|
+
}
|
|
76
93
|
## Documentation
|
|
77
94
|
|
|
78
95
|
You can read the [ruby docs](https://www.rubydoc.info/github/psu-libraries/scholarsphere-client/main) for the latest features.
|
|
@@ -16,7 +16,7 @@ module Scholarsphere
|
|
|
16
16
|
# files: files,
|
|
17
17
|
# depositor: 'abc123'
|
|
18
18
|
# )
|
|
19
|
-
# response = ingest.
|
|
19
|
+
# response = ingest.create
|
|
20
20
|
#
|
|
21
21
|
# If the response is successful, the application returns 200 OK with JSON:
|
|
22
22
|
#
|
|
@@ -25,10 +25,27 @@ module Scholarsphere
|
|
|
25
25
|
# "message": "Work was successfully created",
|
|
26
26
|
# "url": "/resources/0797e99c-7d4f-4e05-8bf6-86aea1029a6a"
|
|
27
27
|
# }
|
|
28
|
+
# ## Creating a new draft
|
|
28
29
|
#
|
|
29
|
-
#
|
|
30
|
+
# A Work can also be created without publishing it by passing a 'false' parameter.
|
|
31
|
+
#
|
|
32
|
+
# ingest = Scholarsphere::Client::Ingest.new(
|
|
33
|
+
# metadata: metadata,
|
|
34
|
+
# files: files,
|
|
35
|
+
# depositor: 'abc123',
|
|
36
|
+
# publish: false
|
|
37
|
+
# )
|
|
38
|
+
# response = ingest.create
|
|
30
39
|
#
|
|
31
|
-
#
|
|
40
|
+
# If the response is successful, it will return a 201 Created with JSON:
|
|
41
|
+
# puts response.body
|
|
42
|
+
# {
|
|
43
|
+
# "message": "Work was successfully created",
|
|
44
|
+
# "url": "/resources/0797e99c-7d4f-4e05-8bf6-86aea1029a6a",
|
|
45
|
+
# "edit_url": "/dashboard/form/work_versions/8/files"
|
|
46
|
+
# }
|
|
47
|
+
#
|
|
48
|
+
# Other possible outcomes include:
|
|
32
49
|
# * work could not be created due to insufficient parameters (422 Unprocessable Entity)
|
|
33
50
|
# * there was an error with the application (500 Internal Server Error)
|
|
34
51
|
#
|
|
@@ -79,25 +96,28 @@ module Scholarsphere
|
|
|
79
96
|
#
|
|
80
97
|
#
|
|
81
98
|
class Ingest
|
|
82
|
-
attr_reader :content, :metadata, :depositor, :permissions
|
|
99
|
+
attr_reader :content, :metadata, :depositor, :permissions, :publish
|
|
83
100
|
|
|
84
101
|
# @param metadata [Hash] Metadata attributes
|
|
85
102
|
# @param files [Array<File,IO,Pathnme>,Hash] An array of File or IO objects, or a hash with a :file param
|
|
86
103
|
# @param depositor [String] access id of the depositor
|
|
87
104
|
# @param permissions [Hash] (optional) Additional permissions to apply to the resource
|
|
88
|
-
|
|
105
|
+
# @param publish [Boolean] (optional) Whether the new Work should be published. Defaults to true
|
|
106
|
+
def initialize(metadata:, files:, depositor:, permissions: {}, publish: true)
|
|
89
107
|
@content = build_content_hash(files)
|
|
90
108
|
@metadata = metadata
|
|
91
109
|
@depositor = depositor
|
|
92
110
|
@permissions = permissions
|
|
111
|
+
@publish = publish
|
|
93
112
|
end
|
|
94
113
|
|
|
95
114
|
# @return [Faraday::Response] The response from the Scholarsphere application.
|
|
96
|
-
def
|
|
115
|
+
def create
|
|
97
116
|
upload_files
|
|
98
117
|
connection.post do |req|
|
|
99
118
|
req.url 'ingest'
|
|
100
|
-
req.body = { metadata: metadata, content: content, depositor: depositor, permissions: permissions
|
|
119
|
+
req.body = { metadata: metadata, content: content, depositor: depositor, permissions: permissions,
|
|
120
|
+
publish: publish }.to_json
|
|
101
121
|
end
|
|
102
122
|
end
|
|
103
123
|
|
data/sample.rb
CHANGED
|
@@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
34
34
|
spec.require_paths = ['lib']
|
|
35
35
|
|
|
36
|
-
spec.add_dependency 'aws-sdk-s3', '~> 1.
|
|
37
|
-
spec.add_dependency 'faraday', '
|
|
38
|
-
spec.add_dependency 'marcel', '~> 1.0'
|
|
39
|
-
spec.add_dependency 'mutex_m', '~> 0.3'
|
|
36
|
+
spec.add_dependency 'aws-sdk-s3', '~> 1.233.2'
|
|
37
|
+
spec.add_dependency 'faraday', '~> 2.15.0'
|
|
38
|
+
spec.add_dependency 'marcel', '~> 2.1.0'
|
|
39
|
+
spec.add_dependency 'mutex_m', '~> 0.3.0'
|
|
40
40
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scholarsphere-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Wead
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: aws-sdk-s3
|
|
@@ -15,56 +15,56 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 1.233.2
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 1.233.2
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: faraday
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 2.15.0
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 2.15.0
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: marcel
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 2.1.0
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
version: 2.1.0
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: mutex_m
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
60
|
+
version: 0.3.0
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
67
|
+
version: 0.3.0
|
|
68
68
|
description: Client software to create new content for the Scholarsphere repository
|
|
69
69
|
at Penn State.
|
|
70
70
|
email:
|
|
@@ -82,6 +82,7 @@ files:
|
|
|
82
82
|
- Gemfile.lock
|
|
83
83
|
- README.md
|
|
84
84
|
- Rakefile
|
|
85
|
+
- bin/check_dependencies.rb
|
|
85
86
|
- bin/clean-vcr-files
|
|
86
87
|
- bin/console
|
|
87
88
|
- bin/setup
|
|
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
119
120
|
- !ruby/object:Gem::Version
|
|
120
121
|
version: '0'
|
|
121
122
|
requirements: []
|
|
122
|
-
rubygems_version: 3.6.
|
|
123
|
+
rubygems_version: 3.6.9
|
|
123
124
|
specification_version: 4
|
|
124
125
|
summary: Client to connect to Scholarpshere
|
|
125
126
|
test_files: []
|