collectionspace-client 0.14.1 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,192 +3,204 @@
3
3
  module CollectionSpace
4
4
  # CollectionSpace service
5
5
  class Service
6
- TERM_SUFFIX = 'TermGroupList/0/termDisplayName'
7
- def self.get(type:, subtype: '')
6
+ TERM_SUFFIX = "TermGroupList/0/termDisplayName"
7
+ def self.get(type:, subtype: "")
8
8
  {
9
- 'acquisitions' => {
10
- identifier: 'acquisitionReferenceNumber',
11
- ns_prefix: 'acquisitions',
12
- path: 'acquisitions',
9
+ "acquisitions" => {
10
+ identifier: "acquisitionReferenceNumber",
11
+ ns_prefix: "acquisitions",
12
+ path: "acquisitions",
13
13
  term: nil
14
14
  },
15
- 'citationauthorities' => {
16
- identifier: 'shortIdentifier',
17
- ns_prefix: 'citations',
15
+ "chronologyauthorities" => {
16
+ identifier: "shortIdentifier",
17
+ ns_prefix: "chronologies",
18
+ path: "chronologyauthorities/urn:cspace:name(#{subtype})/items",
19
+ term: "chronology#{TERM_SUFFIX}"
20
+ },
21
+ "citationauthorities" => {
22
+ identifier: "shortIdentifier",
23
+ ns_prefix: "citations",
18
24
  path: "citationauthorities/urn:cspace:name(#{subtype})/items",
19
25
  term: "citation#{TERM_SUFFIX}"
20
26
  },
21
- 'claims' => {
22
- identifier: 'claimNumber',
23
- ns_prefix: 'claims',
24
- path: 'claims',
27
+ "claims" => {
28
+ identifier: "claimNumber",
29
+ ns_prefix: "claims",
30
+ path: "claims",
25
31
  term: nil
26
32
  },
27
- 'collectionobjects' => {
28
- identifier: 'objectNumber',
29
- ns_prefix: 'collectionobjects',
30
- path: 'collectionobjects',
33
+ "collectionobjects" => {
34
+ identifier: "objectNumber",
35
+ ns_prefix: "collectionobjects",
36
+ path: "collectionobjects",
31
37
  term: nil
32
38
  },
33
- 'conceptauthorities' => {
34
- identifier: 'shortIdentifier',
35
- ns_prefix: 'concepts',
39
+ "conceptauthorities" => {
40
+ identifier: "shortIdentifier",
41
+ ns_prefix: "concepts",
36
42
  path: "conceptauthorities/urn:cspace:name(#{subtype})/items",
37
43
  term: "concept#{TERM_SUFFIX}"
38
44
  },
39
- 'conditionchecks' => {
40
- identifier: 'conditionCheckRefNumber',
41
- ns_prefix: 'conditionchecks',
42
- path: 'conditionchecks',
45
+ "conditionchecks" => {
46
+ identifier: "conditionCheckRefNumber",
47
+ ns_prefix: "conditionchecks",
48
+ path: "conditionchecks",
49
+ term: nil
50
+ },
51
+ "conservation" => {
52
+ identifier: "conservationNumber",
53
+ ns_prefix: "conservation",
54
+ path: "conservation",
43
55
  term: nil
44
56
  },
45
- 'conservation' => {
46
- identifier: 'conservationNumber',
47
- ns_prefix: 'conservation',
48
- path: 'conservation',
57
+ "exhibitions" => {
58
+ identifier: "exhibitionNumber",
59
+ ns_prefix: "exhibitions",
60
+ path: "exhibitions",
49
61
  term: nil
50
62
  },
51
- 'exhibitions' => {
52
- identifier: 'exhibitionNumber',
53
- ns_prefix: 'exhibitions',
54
- path: 'exhibitions',
63
+ "groups" => {
64
+ identifier: "title",
65
+ ns_prefix: "groups",
66
+ path: "groups",
55
67
  term: nil
56
68
  },
57
- 'groups' => {
58
- identifier: 'title',
59
- ns_prefix: 'groups',
60
- path: 'groups',
69
+ "insurances" => {
70
+ identifier: "insuranceIndemnityReferenceNumber",
71
+ ns_prefix: "insurances",
72
+ path: "insurances",
61
73
  term: nil
62
74
  },
63
- 'insurances' => {
64
- identifier: 'insuranceIndemnityReferenceNumber',
65
- ns_prefix: 'insurances',
66
- path: 'insurances',
75
+ "intakes" => {
76
+ identifier: "entryNumber",
77
+ ns_prefix: "intakes",
78
+ path: "intakes",
67
79
  term: nil
68
80
  },
69
- 'intakes' => {
70
- identifier: 'entryNumber',
71
- ns_prefix: 'intakes',
72
- path: 'intakes',
81
+ "iterationreports" => {
82
+ identifier: "iterationIdentificationNumber",
83
+ ns_prefix: "iterationreports",
84
+ path: "iterationreports",
73
85
  term: nil
74
86
  },
75
- 'loansin' => {
76
- identifier: 'loanInNumber',
77
- ns_prefix: 'loansin',
78
- path: 'loansin',
87
+ "loansin" => {
88
+ identifier: "loanInNumber",
89
+ ns_prefix: "loansin",
90
+ path: "loansin",
79
91
  term: nil
80
92
  },
81
- 'loansout' => {
82
- identifier: 'loanOutNumber',
83
- ns_prefix: 'loansout',
84
- path: 'loansout',
93
+ "loansout" => {
94
+ identifier: "loanOutNumber",
95
+ ns_prefix: "loansout",
96
+ path: "loansout",
85
97
  term: nil
86
98
  },
87
- 'locationauthorities' => {
88
- identifier: 'shortIdentifier',
89
- ns_prefix: 'locations',
99
+ "locationauthorities" => {
100
+ identifier: "shortIdentifier",
101
+ ns_prefix: "locations",
90
102
  path: "locationauthorities/urn:cspace:name(#{subtype})/items",
91
103
  term: "loc#{TERM_SUFFIX}"
92
104
  },
93
- 'materialauthorities' => {
94
- identifier: 'shortIdentifier',
95
- ns_prefix: 'materials',
105
+ "materialauthorities" => {
106
+ identifier: "shortIdentifier",
107
+ ns_prefix: "materials",
96
108
  path: "materialauthorities/urn:cspace:name(#{subtype})/items",
97
109
  term: "material#{TERM_SUFFIX}"
98
110
  },
99
- 'media' => {
100
- identifier: 'identificationNumber',
101
- ns_prefix: 'media',
102
- path: 'media',
111
+ "media" => {
112
+ identifier: "identificationNumber",
113
+ ns_prefix: "media",
114
+ path: "media",
103
115
  term: nil
104
116
  },
105
- 'movements' => {
106
- identifier: 'movementReferenceNumber',
107
- ns_prefix: 'movements',
108
- path: 'movements',
117
+ "movements" => {
118
+ identifier: "movementReferenceNumber",
119
+ ns_prefix: "movements",
120
+ path: "movements",
109
121
  term: nil
110
122
  },
111
- 'objectexit' => {
112
- identifier: 'exitNumber',
113
- ns_prefix: 'objectexit',
114
- path: 'objectexit',
123
+ "objectexit" => {
124
+ identifier: "exitNumber",
125
+ ns_prefix: "objectexit",
126
+ path: "objectexit",
115
127
  term: nil
116
128
  },
117
- 'orgauthorities' => {
118
- identifier: 'shortIdentifier',
119
- ns_prefix: 'organizations',
129
+ "orgauthorities" => {
130
+ identifier: "shortIdentifier",
131
+ ns_prefix: "organizations",
120
132
  path: "orgauthorities/urn:cspace:name(#{subtype})/items",
121
133
  term: "org#{TERM_SUFFIX}"
122
134
  },
123
- 'osteology' => {
124
- identifier: 'InventoryID',
125
- ns_prefix: 'osteology',
126
- path: 'osteology',
135
+ "osteology" => {
136
+ identifier: "InventoryID",
137
+ ns_prefix: "osteology",
138
+ path: "osteology",
127
139
  term: nil
128
140
  },
129
- 'personauthorities' => {
130
- identifier: 'shortIdentifier',
131
- ns_prefix: 'persons',
141
+ "personauthorities" => {
142
+ identifier: "shortIdentifier",
143
+ ns_prefix: "persons",
132
144
  path: "personauthorities/urn:cspace:name(#{subtype})/items",
133
145
  term: "person#{TERM_SUFFIX}"
134
146
  },
135
- 'placeauthorities' => {
136
- identifier: 'shortIdentifier',
137
- ns_prefix: 'places',
147
+ "placeauthorities" => {
148
+ identifier: "shortIdentifier",
149
+ ns_prefix: "places",
138
150
  path: "placeauthorities/urn:cspace:name(#{subtype})/items",
139
151
  term: "place#{TERM_SUFFIX}"
140
152
  },
141
- 'pottags' => {
142
- identifier: 'potTagNumber',
143
- ns_prefix: 'pottags',
144
- path: 'pottags',
153
+ "pottags" => {
154
+ identifier: "potTagNumber",
155
+ ns_prefix: "pottags",
156
+ path: "pottags",
145
157
  term: nil
146
158
  },
147
- 'propagations' => {
148
- identifier: 'propNumber',
149
- ns_prefix: 'propagations',
150
- path: 'propagations',
159
+ "propagations" => {
160
+ identifier: "propNumber",
161
+ ns_prefix: "propagations",
162
+ path: "propagations",
151
163
  term: nil
152
164
  },
153
- 'relations' => {
154
- identifier: 'csid',
155
- ns_prefix: 'relations',
156
- path: 'relations',
165
+ "relations" => {
166
+ identifier: "csid",
167
+ ns_prefix: "relations",
168
+ path: "relations",
157
169
  term: nil
158
170
  },
159
- 'taxonomyauthority' => {
160
- identifier: 'shortIdentifier',
161
- ns_prefix: 'taxon',
171
+ "taxonomyauthority" => {
172
+ identifier: "shortIdentifier",
173
+ ns_prefix: "taxon",
162
174
  path: "taxonomyauthority/urn:cspace:name(#{subtype})/items",
163
175
  term: "taxon#{TERM_SUFFIX}"
164
176
  },
165
- 'transports' => {
166
- identifier: 'transportReferenceNumber',
167
- ns_prefix: 'transports',
168
- path: 'transports',
177
+ "transports" => {
178
+ identifier: "transportReferenceNumber",
179
+ ns_prefix: "transports",
180
+ path: "transports",
169
181
  term: nil
170
182
  },
171
- 'uoc' => {
172
- identifier: 'referenceNumber',
173
- ns_prefix: 'uoc',
174
- path: 'uoc',
183
+ "uoc" => {
184
+ identifier: "referenceNumber",
185
+ ns_prefix: "uoc",
186
+ path: "uoc",
175
187
  term: nil
176
188
  },
177
- 'valuationcontrols' => {
178
- identifier: 'valuationcontrolRefNumber',
179
- ns_prefix: 'valuationcontrols',
180
- path: 'valuationcontrols',
189
+ "valuationcontrols" => {
190
+ identifier: "valuationcontrolRefNumber",
191
+ ns_prefix: "valuationcontrols",
192
+ path: "valuationcontrols",
181
193
  term: nil
182
194
  },
183
- 'vocabularies' => {
184
- identifier: 'shortIdentifier',
185
- ns_prefix: 'vocabularyitems',
195
+ "vocabularies" => {
196
+ identifier: "shortIdentifier",
197
+ ns_prefix: "vocabularyitems",
186
198
  path: "vocabularies/urn:cspace:name(#{subtype})/items",
187
- term: 'displayName'
199
+ term: "displayName"
188
200
  },
189
- 'workauthorities' => {
190
- identifier: 'shortIdentifier',
191
- ns_prefix: 'works',
201
+ "workauthorities" => {
202
+ identifier: "shortIdentifier",
203
+ ns_prefix: "works",
192
204
  path: "workauthorities/urn:cspace:name(#{subtype})/items",
193
205
  term: "work#{TERM_SUFFIX}"
194
206
  }
@@ -3,12 +3,12 @@
3
3
  module CollectionSpace
4
4
  module Template
5
5
  def self.list
6
- Dir.glob File.join(templates_path, '*.erb')
6
+ Dir.glob File.join(templates_path, "*.erb")
7
7
  end
8
8
 
9
9
  def self.process(template, data)
10
10
  t = ERB.new(read(template))
11
- r = t.result(binding).gsub(/\n+/, "\n")
11
+ r = t.result(binding).squeeze("\n")
12
12
  Nokogiri::XML.parse(r).to_xml
13
13
  end
14
14
 
@@ -18,8 +18,8 @@ module CollectionSpace
18
18
 
19
19
  def self.templates_path
20
20
  ENV.fetch(
21
- 'COLLECTIONSPACE_CLIENT_TEMPLATES_PATH',
22
- File.join(File.dirname(File.expand_path(__FILE__)), 'templates')
21
+ "COLLECTIONSPACE_CLIENT_TEMPLATES_PATH",
22
+ File.join(File.dirname(File.expand_path(__FILE__)), "templates")
23
23
  )
24
24
  end
25
25
  end
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <document name="batch">
3
+ <ns2:batch_common xmlns:ns2="http://collectionspace.org/services/batch">
4
+ <name><%= data.fetch(:name) %></name>
5
+ <notes><%= data.fetch(:notes, data[:name]) %></notes>
6
+ <forDocTypes>
7
+ <% data.fetch(:doctype).each do |doctype| %>
8
+ <forDocType><%= doctype %></forDocType>
9
+ <% end %>
10
+ </forDocTypes>
11
+ <supportsSingleDoc><%= data.fetch(:supports_single_doc, 'true') %></supportsSingleDoc>
12
+ <supportsDocList><%= data.fetch(:supports_doc_list, 'false') %></supportsDocList>
13
+ <supportsGroup><%= data.fetch(:supports_group, 'false') %></supportsGroup>
14
+ <supportsNoContext><%= data.fetch(:supports_no_context, 'true') %></supportsNoContext>
15
+ <createsNewFocus><%= data.fetch(:creates_new_focus, 'false') %></createsNewFocus>
16
+ <className><%= data.fetch(:classname) %></className>
17
+ </ns2:batch_common>
18
+ </document>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CollectionSpace
4
4
  class Client
5
- VERSION = '0.14.1'
5
+ VERSION = "0.15.1"
6
6
  end
7
7
  end
@@ -1,21 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'httparty'
4
- require 'nokogiri'
5
- require 'uri'
3
+ require "httparty"
4
+ require "nokogiri"
5
+ require "uri"
6
6
 
7
7
  # mixins required first
8
- require 'collectionspace/client/helpers'
9
- require 'collectionspace/client/template'
10
-
11
- require 'collectionspace/client/client'
12
- require 'collectionspace/client/configuration'
13
- require 'collectionspace/client/refname'
14
- require 'collectionspace/client/request'
15
- require 'collectionspace/client/response'
16
- require 'collectionspace/client/search'
17
- require 'collectionspace/client/service'
18
- require 'collectionspace/client/version'
8
+ require "collectionspace/client/helpers"
9
+ require "collectionspace/client/template"
10
+
11
+ require "collectionspace/client/batch"
12
+ require "collectionspace/client/client"
13
+ require "collectionspace/client/configuration"
14
+ require "collectionspace/client/refname"
15
+ require "collectionspace/client/report"
16
+ require "collectionspace/client/request"
17
+ require "collectionspace/client/response"
18
+ require "collectionspace/client/search"
19
+ require "collectionspace/client/service"
20
+ require "collectionspace/client/version"
19
21
 
20
22
  module CollectionSpace
21
23
  class ArgumentError < StandardError; end
@@ -24,7 +26,7 @@ module CollectionSpace
24
26
 
25
27
  class NotFoundError < StandardError; end
26
28
 
27
- class PayloadError < StandardError; end
29
+ class PayloadError < StandardError; end
28
30
 
29
- class RequestError < StandardError; end
31
+ class RequestError < StandardError; end
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collectionspace-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Cooper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-19 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '10.0'
103
+ version: '13.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.0'
110
+ version: '13.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.21'
153
153
  - !ruby/object:Gem::Dependency
154
- name: vcr
154
+ name: standard
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: vcr
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '6.1'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '6.1'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: webmock
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -178,13 +192,15 @@ dependencies:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
- description:
195
+ description: Client for interacting with CollectionSpace Services API
182
196
  email:
183
197
  - mark.cooper@lyrasis.org
184
198
  executables: []
185
199
  extensions: []
186
200
  extra_rdoc_files: []
187
201
  files:
202
+ - ".git-blame-ignore-revs"
203
+ - ".github/workflows/ci.yml"
188
204
  - ".github/workflows/publish.yml"
189
205
  - ".gitignore"
190
206
  - ".rspec"
@@ -192,28 +208,34 @@ files:
192
208
  - ".ruby-version"
193
209
  - ".travis.yml"
194
210
  - Gemfile
211
+ - Gemfile.lock
195
212
  - LICENSE.txt
196
213
  - README.md
197
214
  - Rakefile
198
215
  - bin/console
199
216
  - bin/rspec
200
217
  - collectionspace-client.gemspec
218
+ - examples/batches.rb
201
219
  - examples/demo.rb
202
220
  - examples/media_with_external_file.rb
203
221
  - examples/purge_empty_vocabs.rb
204
222
  - examples/reports.rb
223
+ - examples/reset_media_blob.rb
205
224
  - examples/search.rb
206
225
  - examples/update_password.rb
207
226
  - lib/collectionspace/client.rb
227
+ - lib/collectionspace/client/batch.rb
208
228
  - lib/collectionspace/client/client.rb
209
229
  - lib/collectionspace/client/configuration.rb
210
230
  - lib/collectionspace/client/helpers.rb
211
231
  - lib/collectionspace/client/refname.rb
232
+ - lib/collectionspace/client/report.rb
212
233
  - lib/collectionspace/client/request.rb
213
234
  - lib/collectionspace/client/response.rb
214
235
  - lib/collectionspace/client/search.rb
215
236
  - lib/collectionspace/client/service.rb
216
237
  - lib/collectionspace/client/template.rb
238
+ - lib/collectionspace/client/templates/batch.xml.erb
217
239
  - lib/collectionspace/client/templates/reindex_by_csids.xml.erb
218
240
  - lib/collectionspace/client/templates/reindex_by_doctype.xml.erb
219
241
  - lib/collectionspace/client/templates/reindex_full_text.xml.erb
@@ -232,14 +254,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
254
  requirements:
233
255
  - - ">="
234
256
  - !ruby/object:Gem::Version
235
- version: '0'
257
+ version: 2.7.4
236
258
  required_rubygems_version: !ruby/object:Gem::Requirement
237
259
  requirements:
238
260
  - - ">="
239
261
  - !ruby/object:Gem::Version
240
262
  version: '0'
241
263
  requirements: []
242
- rubygems_version: 3.3.18
264
+ rubygems_version: 3.4.20
243
265
  signing_key:
244
266
  specification_version: 4
245
267
  summary: CollectionSpace API client.