scholarsphere-client 0.5.1 → 0.5.3
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 +0 -11
- data/Gemfile +1 -3
- data/Gemfile.lock +11 -10
- data/README.md +18 -1
- data/lib/scholarsphere/client/ingest.rb +27 -7
- data/lib/scholarsphere/client/version.rb +1 -1
- data/sample.rb +1 -1
- 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: 8c93e287718b93836734e16881ffa6e9f800a21f4eb8e3b7768a63cdb18f54d1
|
|
4
|
+
data.tar.gz: f5fdb85f67fda641bbcc877e2dd728b28f725b819b63ddef70de5123077934bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 444420739ff3d2a4a08b91bdb442c8e637369834cfa218f53bef9b457b2ec23863e31b3a8768af73508b1702eb3c8b9e70210dbfc298dc1a80f4b2ff2c561b75
|
|
7
|
+
data.tar.gz: 61b1fc62c5c46e1a367c04b8fbd58a2d5ec55631d9a2534ed185f3f1e8313e92a46a52687b777c77f6a11004945db5ab88fa072f68e4f8edf3e31b91c374331b
|
data/.circleci/config.yml
CHANGED
|
@@ -24,17 +24,6 @@ jobs:
|
|
|
24
24
|
name: "Copy VCR Logs"
|
|
25
25
|
when: on_fail
|
|
26
26
|
command: cp vcr.log /tmp/vcr.log
|
|
27
|
-
- run:
|
|
28
|
-
name: "Upload Coverage"
|
|
29
|
-
when: on_success
|
|
30
|
-
command: |
|
|
31
|
-
wget -q https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 -O cc-test-reporter
|
|
32
|
-
chmod 755 cc-test-reporter
|
|
33
|
-
export TAG=${CIRCLE_SHA1}
|
|
34
|
-
export GIT_COMMIT_SHA=$CIRCLE_SHA1
|
|
35
|
-
export GIT_BRANCH=$CIRCLE_BRANCH
|
|
36
|
-
export GIT_COMMITED_AT=$(git log -1 --date=short --pretty=format:%ct)
|
|
37
|
-
./cc-test-reporter after-build -d
|
|
38
27
|
- store_artifacts:
|
|
39
28
|
path: /tmp/vcr.log
|
|
40
29
|
destination: VCR
|
data/Gemfile
CHANGED
|
@@ -13,10 +13,8 @@ group :development do
|
|
|
13
13
|
gem 'rake', '>= 12.3.3'
|
|
14
14
|
gem 'rspec', '~> 3.0'
|
|
15
15
|
gem 'rspec-its', '~> 1.3'
|
|
16
|
+
gem 'simplecov'
|
|
16
17
|
gem 'vcr', '~> 6.0'
|
|
17
18
|
gem 'webmock', '~> 3.11'
|
|
18
19
|
gem 'yard', '< 1.0'
|
|
19
|
-
|
|
20
|
-
# Latest version of simplecov is not compatible with Code Climate
|
|
21
|
-
gem 'simplecov', '< 0.18'
|
|
22
20
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
scholarsphere-client (0.5.
|
|
4
|
+
scholarsphere-client (0.5.3)
|
|
5
5
|
aws-sdk-s3 (~> 1.49)
|
|
6
6
|
faraday (> 0.12)
|
|
7
7
|
marcel (~> 1.0)
|
|
@@ -70,7 +70,7 @@ GEM
|
|
|
70
70
|
rexml
|
|
71
71
|
crass (1.0.6)
|
|
72
72
|
diff-lcs (1.4.4)
|
|
73
|
-
docile (1.4.
|
|
73
|
+
docile (1.4.1)
|
|
74
74
|
drb (2.2.3)
|
|
75
75
|
erb_lint (0.9.0)
|
|
76
76
|
activesupport
|
|
@@ -118,7 +118,7 @@ GEM
|
|
|
118
118
|
rubocop-rspec (~> 3.5)
|
|
119
119
|
rubocop-rspec_rails (~> 2.30)
|
|
120
120
|
scss_lint (~> 0.60)
|
|
121
|
-
nokogiri (1.18.
|
|
121
|
+
nokogiri (1.18.10)
|
|
122
122
|
mini_portile2 (~> 2.8.2)
|
|
123
123
|
racc (~> 1.4)
|
|
124
124
|
parallel (1.26.3)
|
|
@@ -133,7 +133,7 @@ GEM
|
|
|
133
133
|
pry (>= 0.13, < 0.15)
|
|
134
134
|
public_suffix (6.0.1)
|
|
135
135
|
racc (1.8.1)
|
|
136
|
-
rack (3.
|
|
136
|
+
rack (3.2.4)
|
|
137
137
|
rails-dom-testing (2.3.0)
|
|
138
138
|
activesupport (>= 5.0.0)
|
|
139
139
|
minitest
|
|
@@ -147,7 +147,7 @@ GEM
|
|
|
147
147
|
rb-inotify (0.11.1)
|
|
148
148
|
ffi (~> 1.0)
|
|
149
149
|
regexp_parser (2.10.0)
|
|
150
|
-
rexml (3.4.
|
|
150
|
+
rexml (3.4.4)
|
|
151
151
|
rspec (3.10.0)
|
|
152
152
|
rspec-core (~> 3.10.0)
|
|
153
153
|
rspec-expectations (~> 3.10.0)
|
|
@@ -210,11 +210,12 @@ GEM
|
|
|
210
210
|
scss_lint (0.60.0)
|
|
211
211
|
sass (~> 3.5, >= 3.5.5)
|
|
212
212
|
securerandom (0.4.1)
|
|
213
|
-
simplecov (0.
|
|
213
|
+
simplecov (0.22.0)
|
|
214
214
|
docile (~> 1.1)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
simplecov-html (0.
|
|
215
|
+
simplecov-html (~> 0.11)
|
|
216
|
+
simplecov_json_formatter (~> 0.1)
|
|
217
|
+
simplecov-html (0.13.2)
|
|
218
|
+
simplecov_json_formatter (0.1.4)
|
|
218
219
|
smart_properties (1.17.0)
|
|
219
220
|
tzinfo (2.0.6)
|
|
220
221
|
concurrent-ruby (~> 1.0)
|
|
@@ -241,7 +242,7 @@ DEPENDENCIES
|
|
|
241
242
|
rspec (~> 3.0)
|
|
242
243
|
rspec-its (~> 1.3)
|
|
243
244
|
scholarsphere-client!
|
|
244
|
-
simplecov
|
|
245
|
+
simplecov
|
|
245
246
|
vcr (~> 6.0)
|
|
246
247
|
webmock (~> 3.11)
|
|
247
248
|
yard (< 1.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
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Wead
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-05-27 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: aws-sdk-s3
|
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
119
119
|
- !ruby/object:Gem::Version
|
|
120
120
|
version: '0'
|
|
121
121
|
requirements: []
|
|
122
|
-
rubygems_version: 3.6.
|
|
122
|
+
rubygems_version: 3.6.6
|
|
123
123
|
specification_version: 4
|
|
124
124
|
summary: Client to connect to Scholarpshere
|
|
125
125
|
test_files: []
|