collectionspace-client 0.3.0 → 0.14.1
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/.github/workflows/publish.yml +42 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/README.md +11 -14
- data/Rakefile +41 -0
- data/bin/console +26 -0
- data/bin/rspec +29 -0
- data/collectionspace-client.gemspec +2 -0
- data/examples/demo.rb +2 -0
- data/examples/media_with_external_file.rb +2 -0
- data/examples/purge_empty_vocabs.rb +2 -0
- data/examples/reports.rb +178 -0
- data/examples/search.rb +17 -4
- data/examples/update_password.rb +1 -31
- data/lib/collectionspace/client/client.rb +4 -2
- data/lib/collectionspace/client/configuration.rb +15 -14
- data/lib/collectionspace/client/helpers.rb +131 -10
- data/lib/collectionspace/client/refname.rb +114 -0
- data/lib/collectionspace/client/request.rb +2 -0
- data/lib/collectionspace/client/response.rb +11 -0
- data/lib/collectionspace/client/search.rb +7 -3
- data/lib/collectionspace/client/service.rb +198 -0
- data/lib/collectionspace/client/template.rb +26 -0
- data/lib/collectionspace/client/templates/reindex_by_csids.xml.erb +10 -0
- data/lib/collectionspace/client/templates/reindex_by_doctype.xml.erb +5 -0
- data/lib/collectionspace/client/templates/reindex_full_text.xml.erb +51 -0
- data/lib/collectionspace/client/templates/report.xml.erb +16 -0
- data/lib/collectionspace/client/templates/reset_media_blob.xml.erb +6 -0
- data/lib/collectionspace/client/version.rb +3 -1
- data/lib/collectionspace/client.rb +11 -0
- metadata +44 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89651eb1e87693f52f835cbe34eccc510f40888db54696a41082ae114a084817
|
4
|
+
data.tar.gz: e3c161e2a64848a1f0065e18da8aa23ad6117995daf62538cf5437bc0192cfc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d9d9989ff3272bffe9fc99c19036e72004b7e672bc3d02ce5556b69bb478a441a78768d394685534ba83144d76054903bac35fa4f715c50cff32b838e60132c
|
7
|
+
data.tar.gz: 7bea83ddcadf1aa7019e196c8ede59cd9e9ffd6fdd9b23a90ff7d0f89666122cb6c865a0b422287cb8a04d4032718e493e48f23b6356d65039a1bde00626e53b
|
@@ -0,0 +1,42 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
- master
|
8
|
+
jobs:
|
9
|
+
publish:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: write
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v3
|
16
|
+
|
17
|
+
- name: Setup Ruby and install gems
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
bundler-cache: true
|
21
|
+
ruby-version: 2.7
|
22
|
+
rubygems: latest
|
23
|
+
|
24
|
+
- name: Release Gem
|
25
|
+
run: |
|
26
|
+
VERSION=$(bundle exec rake version)
|
27
|
+
GEM_VERSION=$(gem list --exact --remote $GEM_NAME)
|
28
|
+
|
29
|
+
# Publish to RubyGems.org
|
30
|
+
if [ "${GEM_VERSION}" != "$GEM_NAME (${VERSION})" ]; then
|
31
|
+
gem build $GEM_NAME.gemspec
|
32
|
+
gem push "$GEM_NAME-${VERSION}.gem"
|
33
|
+
fi
|
34
|
+
|
35
|
+
# Create a release tag
|
36
|
+
if ! git ls-remote --tags --exit-code origin v${VERSION}; then
|
37
|
+
git tag v${VERSION}
|
38
|
+
git push --tags
|
39
|
+
fi
|
40
|
+
env:
|
41
|
+
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
|
42
|
+
GEM_NAME: collectionspace-client
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.4
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,13 +4,13 @@ CollectionSpace API client.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
Add this line to your application's Gemfile:
|
7
|
+
Add this line to your application's Gemfile (replace `$VERSION` with an available tag):
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'collectionspace-client'
|
10
|
+
gem 'collectionspace-client', tag: $VERSION, git: 'https://github.com/collectionspace/collectionspace-client.git'
|
11
11
|
```
|
12
12
|
|
13
|
-
And then execute `bundle install
|
13
|
+
And then execute `bundle install`.
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
@@ -32,19 +32,16 @@ To run the tests:
|
|
32
32
|
bundle exec rake
|
33
33
|
```
|
34
34
|
|
35
|
-
##
|
36
|
-
|
37
|
-
Bump version in `lib/collectionspace/client/version.rb` then:
|
35
|
+
## Releasing
|
38
36
|
|
39
37
|
```bash
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
gem push collectionspace-client-$VERSION.gem
|
38
|
+
gem install gem-release
|
39
|
+
# https://github.com/svenfuchs/gem-release#gem-bump
|
40
|
+
gem bump --version $VERSION --tag
|
41
|
+
# i.e.
|
42
|
+
gem bump --version minor --tag --pretend # dryrun
|
43
|
+
gem bump --version minor --tag # do it for real
|
44
|
+
# PR and merge will publish new version
|
48
45
|
```
|
49
46
|
|
50
47
|
## Contributing
|
data/Rakefile
CHANGED
@@ -1,6 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'base64'
|
6
|
+
require 'collectionspace/client'
|
3
7
|
|
4
8
|
RSpec::Core::RakeTask.new(:spec)
|
5
9
|
|
6
10
|
task default: :spec
|
11
|
+
|
12
|
+
task :version do
|
13
|
+
puts CollectionSpace::Client::VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :cli do
|
17
|
+
desc "Update a user's password: requires an Admin level account to perform the update"
|
18
|
+
task :update_password, [:endpoint, :admin, :password, :user, :new_password] do |_t, args|
|
19
|
+
endpoint = args[:endpoint]
|
20
|
+
admin = args[:admin]
|
21
|
+
password = args[:password]
|
22
|
+
user = args[:user]
|
23
|
+
new_password = args[:new_password]
|
24
|
+
|
25
|
+
client = CollectionSpace::Client.new(
|
26
|
+
CollectionSpace::Configuration.new(
|
27
|
+
base_uri: endpoint,
|
28
|
+
username: admin,
|
29
|
+
password: password
|
30
|
+
)
|
31
|
+
)
|
32
|
+
|
33
|
+
payload = <<~XML
|
34
|
+
<ns2:accounts_common xmlns:ns2="http://collectionspace.org/services/account">
|
35
|
+
<userId>#{user}</userId>
|
36
|
+
<password>#{Base64.encode64(new_password).chomp}</password>
|
37
|
+
</ns2:accounts_common>
|
38
|
+
XML
|
39
|
+
|
40
|
+
client.all('accounts').each do |account|
|
41
|
+
if account['email'] == user
|
42
|
+
puts client.put(account['uri'], payload).parsed
|
43
|
+
break
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
Bundler.require(:tools)
|
6
|
+
|
7
|
+
require_relative '../lib/collectionspace/client'
|
8
|
+
require 'irb'
|
9
|
+
|
10
|
+
module CollectionSpace
|
11
|
+
::CS = CollectionSpace # alias only in console to minimize typing
|
12
|
+
|
13
|
+
module_function
|
14
|
+
|
15
|
+
def coredev
|
16
|
+
CollectionSpace::Client.new(
|
17
|
+
CollectionSpace::Configuration.new(
|
18
|
+
base_uri: 'https://core.dev.collectionspace.org/cspace-services',
|
19
|
+
username: 'admin@core.collectionspace.org',
|
20
|
+
password: 'Administrator'
|
21
|
+
)
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
IRB.start(__FILE__)
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
@@ -23,9 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_development_dependency 'awesome_print'
|
25
25
|
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'pry'
|
26
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
28
|
spec.add_development_dependency 'rspec'
|
28
29
|
spec.add_development_dependency 'rubocop'
|
30
|
+
spec.add_development_dependency 'simplecov', '~> 0.21'
|
29
31
|
spec.add_development_dependency 'vcr'
|
30
32
|
spec.add_development_dependency 'webmock'
|
31
33
|
end
|
data/examples/demo.rb
CHANGED
data/examples/reports.rb
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
4
|
+
require 'awesome_print'
|
5
|
+
require 'collectionspace/client'
|
6
|
+
|
7
|
+
client = CollectionSpace::Client.new(
|
8
|
+
CollectionSpace::Configuration.new(
|
9
|
+
base_uri: 'https://core.dev.collectionspace.org/cspace-services',
|
10
|
+
username: 'admin@core.collectionspace.org',
|
11
|
+
password: 'Administrator'
|
12
|
+
)
|
13
|
+
)
|
14
|
+
|
15
|
+
# https://github.com/collectionspace/Tools/blob/master/scripts/install_report_records.sh
|
16
|
+
# https://github.com/collectionspace/Tools/blob/master/scripts/create-report-records.sh
|
17
|
+
|
18
|
+
STANDARD_REPORTS = [
|
19
|
+
{
|
20
|
+
name: 'Acquisition Summary',
|
21
|
+
notes: 'An acquisition summary report. Runs on a single record only.',
|
22
|
+
doctype: 'Acquisition',
|
23
|
+
supports_single_doc: 'true',
|
24
|
+
supports_doc_list: 'false',
|
25
|
+
supports_group: 'false',
|
26
|
+
supports_no_context: 'false',
|
27
|
+
filename: 'acq_basic.jrxml',
|
28
|
+
mimetype: 'application/pdf'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: 'Acquisition Basic List',
|
32
|
+
notes: 'Catalog info for objects related to an acquisition record. Runs on a single record only.',
|
33
|
+
doctype: 'Acquisition',
|
34
|
+
supports_single_doc: 'true',
|
35
|
+
supports_doc_list: 'false',
|
36
|
+
supports_group: 'false',
|
37
|
+
supports_no_context: 'false',
|
38
|
+
filename: 'Acq_List_Basic.jrxml',
|
39
|
+
mimetype: 'application/pdf'
|
40
|
+
},
|
41
|
+
{
|
42
|
+
name: 'Condition Check Basic List',
|
43
|
+
notes: 'Catalog info for objects related to a condition check record. Runs on a single record only.',
|
44
|
+
doctype: 'Conditioncheck',
|
45
|
+
supports_single_doc: 'true',
|
46
|
+
supports_doc_list: 'false',
|
47
|
+
supports_group: 'false',
|
48
|
+
supports_no_context: 'false',
|
49
|
+
filename: 'CC_List_Basic.jrxml',
|
50
|
+
mimetype: 'application/pdf'
|
51
|
+
},
|
52
|
+
{
|
53
|
+
name: 'Exhibition Basic List',
|
54
|
+
notes: 'Catalog info for objects related to a exhibition record. Runs on a single record only.',
|
55
|
+
doctype: 'Exhibition',
|
56
|
+
supports_single_doc: 'true',
|
57
|
+
supports_doc_list: 'false',
|
58
|
+
supports_group: 'false',
|
59
|
+
supports_no_context: 'false',
|
60
|
+
filename: 'Exhibition_List_Basic.jrxml',
|
61
|
+
mimetype: 'application/pdf'
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: 'Group Basic List',
|
65
|
+
notes: 'Catalog info for objects related to a group record. Runs on a single record only.',
|
66
|
+
doctype: 'Group',
|
67
|
+
supports_single_doc: 'true',
|
68
|
+
supports_doc_list: 'false',
|
69
|
+
supports_group: 'false',
|
70
|
+
supports_no_context: 'false',
|
71
|
+
filename: 'Group_List_Basic.jrxml',
|
72
|
+
mimetype: 'application/pdf'
|
73
|
+
},
|
74
|
+
{
|
75
|
+
name: 'Loan In Basic List',
|
76
|
+
notes: 'Catalog info for objects related to a loan in record. Runs on a single record only.',
|
77
|
+
doctype: 'Loanin',
|
78
|
+
supports_single_doc: 'true',
|
79
|
+
supports_doc_list: 'false',
|
80
|
+
supports_group: 'false',
|
81
|
+
supports_no_context: 'false',
|
82
|
+
filename: 'LoansIn_List_Basic.jrxml',
|
83
|
+
mimetype: 'application/pdf'
|
84
|
+
},
|
85
|
+
{
|
86
|
+
name: 'Loan Out Basic List',
|
87
|
+
notes: 'Catalog info for objects related to a loan out record. Runs on a single record only.',
|
88
|
+
doctype: 'Loanout',
|
89
|
+
supports_single_doc: 'true',
|
90
|
+
supports_doc_list: 'false',
|
91
|
+
supports_group: 'false',
|
92
|
+
supports_no_context: 'false',
|
93
|
+
filename: 'LoansOut_List_Basic.jrxml',
|
94
|
+
mimetype: 'application/pdf'
|
95
|
+
},
|
96
|
+
{
|
97
|
+
name: 'Acquisition Ethnographic Object List',
|
98
|
+
notes: 'Core acquisition report. Runs on a single record only.',
|
99
|
+
doctype: 'Acquisition',
|
100
|
+
supports_single_doc: 'true',
|
101
|
+
supports_doc_list: 'false',
|
102
|
+
supports_group: 'false',
|
103
|
+
supports_no_context: 'false',
|
104
|
+
filename: 'coreAcquisition.jrxml',
|
105
|
+
mimetype: 'application/pdf'
|
106
|
+
},
|
107
|
+
{
|
108
|
+
name: 'Group Object Ethnographic Object List',
|
109
|
+
notes: 'Core group object report. Runs on a single record only.',
|
110
|
+
doctype: 'Group',
|
111
|
+
supports_single_doc: 'true',
|
112
|
+
supports_doc_list: 'false',
|
113
|
+
supports_group: 'false',
|
114
|
+
supports_no_context: 'false',
|
115
|
+
filename: 'coreGroupObject.jrxml',
|
116
|
+
mimetype: 'application/pdf'
|
117
|
+
},
|
118
|
+
{
|
119
|
+
name: 'Intake Ethnographic Object List',
|
120
|
+
notes: 'Core intake report. Runs on a single record only.',
|
121
|
+
doctype: 'Intake',
|
122
|
+
supports_single_doc: 'true',
|
123
|
+
supports_doc_list: 'false',
|
124
|
+
supports_group: 'false',
|
125
|
+
supports_no_context: 'false',
|
126
|
+
filename: 'coreIntake.jrxml',
|
127
|
+
mimetype: 'application/pdf'
|
128
|
+
},
|
129
|
+
{
|
130
|
+
name: 'Loan In Ethnographic Object List',
|
131
|
+
notes: 'Core loan in report. Runs on a single record only.',
|
132
|
+
doctype: 'Loanin',
|
133
|
+
supports_single_doc: 'true',
|
134
|
+
supports_doc_list: 'false',
|
135
|
+
supports_group: 'false',
|
136
|
+
supports_no_context: 'false',
|
137
|
+
filename: 'coreLoanIn.jrxml',
|
138
|
+
mimetype: 'application/pdf'
|
139
|
+
},
|
140
|
+
{
|
141
|
+
name: 'Loan Out Ethnographic Object List',
|
142
|
+
notes: 'Core loan out report. Runs on a single record only.',
|
143
|
+
doctype: 'Loanout',
|
144
|
+
supports_single_doc: 'true',
|
145
|
+
supports_doc_list: 'false',
|
146
|
+
supports_group: 'false',
|
147
|
+
supports_no_context: 'false',
|
148
|
+
filename: 'coreLoanOut.jrxml',
|
149
|
+
mimetype: 'application/pdf'
|
150
|
+
},
|
151
|
+
{
|
152
|
+
name: 'Object Exit Ethnographic Object List',
|
153
|
+
notes: 'Core object exit report. Runs on a single record only.',
|
154
|
+
doctype: 'ObjectExit',
|
155
|
+
supports_single_doc: 'true',
|
156
|
+
supports_doc_list: 'false',
|
157
|
+
supports_group: 'false',
|
158
|
+
supports_no_context: 'false',
|
159
|
+
filename: 'coreObjectExit.jrxml',
|
160
|
+
mimetype: 'application/pdf'
|
161
|
+
},
|
162
|
+
{
|
163
|
+
name: 'Systematic Inventory',
|
164
|
+
notes: 'Generate a checklist for performing an inventory on a range of storage locations. Runs on all records, using the provided start and end locations.',
|
165
|
+
doctype: 'Locationitem',
|
166
|
+
supports_single_doc: 'false',
|
167
|
+
supports_doc_list: 'false',
|
168
|
+
supports_group: 'false',
|
169
|
+
supports_no_context: 'true',
|
170
|
+
filename: 'systematicInventory.jrxml',
|
171
|
+
mimetype: 'application/pdf'
|
172
|
+
}
|
173
|
+
]
|
174
|
+
|
175
|
+
STANDARD_REPORTS.each do |report|
|
176
|
+
response = client.add_report(report)
|
177
|
+
puts response.inspect
|
178
|
+
end
|
data/examples/search.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
4
|
require 'awesome_print'
|
3
5
|
require 'collectionspace/client'
|
@@ -12,10 +14,21 @@ client = CollectionSpace::Client.new(config)
|
|
12
14
|
|
13
15
|
search_args = {
|
14
16
|
path: 'groups',
|
15
|
-
|
17
|
+
namespace: 'groups_common',
|
16
18
|
field: 'title',
|
17
|
-
expression: "ILIKE '%
|
19
|
+
expression: "ILIKE '%D%'"
|
18
20
|
}
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
puts 'Search: %D'
|
23
|
+
response = client.search(
|
24
|
+
CollectionSpace::Search.new.from_hash(search_args),
|
25
|
+
{ sortBy: CollectionSpace::Search::DEFAULT_SORT }
|
26
|
+
)
|
27
|
+
if response.result.success?
|
28
|
+
response.parsed['abstract_common_list']['list_item'].map do |i|
|
29
|
+
puts i['uri']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
puts 'Object and authority term searches have been moved to spec.'
|
34
|
+
puts 'See helpers_spec.rb examples describing find'
|
data/examples/update_password.rb
CHANGED
@@ -1,33 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require 'awesome_print'
|
5
|
-
require 'base64'
|
6
|
-
require 'collectionspace/client'
|
7
|
-
|
8
|
-
CS_CFG_URL = ENV.fetch('CS_CFG_URL', 'https://core.dev.collectionspace.org/cspace-services')
|
9
|
-
CS_CFG_USER = ENV.fetch('CS_CFG_USER', 'admin@core.collectionspace.org')
|
10
|
-
CS_CFG_PASS = ENV.fetch('CS_CFG_PASS', 'Administrator')
|
11
|
-
CS_UPD_USER = ENV.fetch('CS_UPD_USER', 'admin@core.collectionspace.org')
|
12
|
-
CS_UPD_PASS = Base64.encode64(ENV.fetch('CS_UPD_PASS', 'Administrator')).chomp
|
13
|
-
|
14
|
-
client = CollectionSpace::Client.new(
|
15
|
-
CollectionSpace::Configuration.new(
|
16
|
-
base_uri: CS_CFG_URL,
|
17
|
-
username: CS_CFG_USER,
|
18
|
-
password: CS_CFG_PASS
|
19
|
-
)
|
20
|
-
)
|
21
|
-
|
22
|
-
PAYLOAD = <<~XML
|
23
|
-
<ns2:accounts_common xmlns:ns2="http://collectionspace.org/services/account">
|
24
|
-
<userId>#{CS_UPD_USER}</userId>
|
25
|
-
<password>#{CS_UPD_PASS}</password>
|
26
|
-
</ns2:accounts_common>
|
27
|
-
XML
|
28
|
-
|
29
|
-
client.all('accounts').each do |item|
|
30
|
-
next unless item['email'] == CS_UPD_USER
|
31
|
-
|
32
|
-
ap client.put(item['uri'], PAYLOAD).parsed
|
33
|
-
end
|
3
|
+
puts 'Update password has been moved to Rake task: `cli:update_password[args...]`'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CollectionSpace
|
2
4
|
# CollectionSpace client
|
3
5
|
class Client
|
@@ -21,9 +23,9 @@ module CollectionSpace
|
|
21
23
|
request 'POST', path, { body: payload }.merge(options)
|
22
24
|
end
|
23
25
|
|
24
|
-
def put(path, payload)
|
26
|
+
def put(path, payload, options = {})
|
25
27
|
check_payload(payload)
|
26
|
-
request 'PUT', path, body: payload
|
28
|
+
request 'PUT', path, { body: payload }.merge(options)
|
27
29
|
end
|
28
30
|
|
29
31
|
def delete(path)
|
@@ -1,25 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CollectionSpace
|
2
4
|
# CollectionSpace configuration
|
3
5
|
class Configuration
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
DEFAULTS = {
|
7
|
+
base_uri: nil,
|
8
|
+
username: nil,
|
9
|
+
password: nil,
|
10
|
+
page_size: 25,
|
11
|
+
include_deleted: false,
|
12
|
+
throttle: 0,
|
13
|
+
verify_ssl: true
|
14
|
+
}.freeze
|
15
|
+
|
16
|
+
attr_accessor :base_uri, :username, :password, :page_size, :include_deleted, :throttle, :verify_ssl
|
15
17
|
|
16
18
|
def initialize(settings = {})
|
17
|
-
settings =
|
19
|
+
settings = DEFAULTS.merge(settings)
|
18
20
|
settings.each do |property, value|
|
19
|
-
next unless
|
21
|
+
next unless DEFAULTS.key?(property)
|
20
22
|
|
21
23
|
instance_variable_set("@#{property}", value)
|
22
|
-
self.class.send(:attr_accessor, property)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|