collectionspace-client 0.3.0 → 0.15.0
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/.git-blame-ignore-revs +8 -0
- data/.github/workflows/ci.yml +30 -0
- data/.github/workflows/publish.yml +42 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +4 -8
- data/.ruby-version +1 -0
- data/Gemfile +3 -1
- data/README.md +11 -14
- data/Rakefile +44 -2
- data/bin/console +26 -0
- data/bin/rspec +29 -0
- data/collectionspace-client.gemspec +26 -23
- data/examples/batches.rb +50 -0
- data/examples/demo.rb +10 -8
- data/examples/media_with_external_file.rb +11 -9
- data/examples/purge_empty_vocabs.rb +10 -8
- data/examples/reports.rb +45 -0
- data/examples/reset_media_blob.rb +35 -0
- data/examples/search.rb +25 -12
- data/examples/update_password.rb +1 -31
- data/lib/collectionspace/client/batch.rb +55 -0
- data/lib/collectionspace/client/client.rb +19 -6
- data/lib/collectionspace/client/configuration.rb +16 -14
- data/lib/collectionspace/client/helpers.rb +197 -15
- data/lib/collectionspace/client/refname.rb +114 -0
- data/lib/collectionspace/client/report.rb +180 -0
- data/lib/collectionspace/client/request.rb +12 -9
- data/lib/collectionspace/client/response.rb +14 -3
- data/lib/collectionspace/client/search.rb +9 -5
- data/lib/collectionspace/client/service.rb +204 -0
- data/lib/collectionspace/client/template.rb +26 -0
- data/lib/collectionspace/client/templates/batch.xml.erb +18 -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 +25 -12
- metadata +68 -6
@@ -0,0 +1,180 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CollectionSpace
|
4
|
+
# CollectionSpace report
|
5
|
+
class Report
|
6
|
+
def self.all
|
7
|
+
[
|
8
|
+
{
|
9
|
+
name: "Acquisition Summary",
|
10
|
+
notes: "An acquisition summary report. Runs on a single record only.",
|
11
|
+
doctype: "Acquisition",
|
12
|
+
supports_single_doc: "true",
|
13
|
+
supports_doc_list: "false",
|
14
|
+
supports_group: "false",
|
15
|
+
supports_no_context: "false",
|
16
|
+
filename: "acq_basic.jrxml",
|
17
|
+
mimetype: "application/pdf"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
name: "Acquisition Basic List",
|
21
|
+
notes: "Catalog info for objects related to an acquisition record. 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_List_Basic.jrxml",
|
28
|
+
mimetype: "application/pdf"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: "Condition Check Basic List",
|
32
|
+
notes: "Catalog info for objects related to a condition check record. Runs on a single record only.",
|
33
|
+
doctype: "Conditioncheck",
|
34
|
+
supports_single_doc: "true",
|
35
|
+
supports_doc_list: "false",
|
36
|
+
supports_group: "false",
|
37
|
+
supports_no_context: "false",
|
38
|
+
filename: "CC_List_Basic.jrxml",
|
39
|
+
mimetype: "application/pdf"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
name: "Exhibition Basic List",
|
43
|
+
notes: "Catalog info for objects related to a exhibition record. Runs on a single record only.",
|
44
|
+
doctype: "Exhibition",
|
45
|
+
supports_single_doc: "true",
|
46
|
+
supports_doc_list: "false",
|
47
|
+
supports_group: "false",
|
48
|
+
supports_no_context: "false",
|
49
|
+
filename: "Exhibition_List_Basic.jrxml",
|
50
|
+
mimetype: "application/pdf"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
name: "Group Basic List",
|
54
|
+
notes: "Catalog info for objects related to a group record. Runs on a single record only.",
|
55
|
+
doctype: "Group",
|
56
|
+
supports_single_doc: "true",
|
57
|
+
supports_doc_list: "false",
|
58
|
+
supports_group: "false",
|
59
|
+
supports_no_context: "false",
|
60
|
+
filename: "Group_List_Basic.jrxml",
|
61
|
+
mimetype: "application/pdf"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: "Loan In Basic List",
|
65
|
+
notes: "Catalog info for objects related to a loan in record. Runs on a single record only.",
|
66
|
+
doctype: "Loanin",
|
67
|
+
supports_single_doc: "true",
|
68
|
+
supports_doc_list: "false",
|
69
|
+
supports_group: "false",
|
70
|
+
supports_no_context: "false",
|
71
|
+
filename: "LoansIn_List_Basic.jrxml",
|
72
|
+
mimetype: "application/pdf"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
name: "Loan Out Basic List",
|
76
|
+
notes: "Catalog info for objects related to a loan out record. Runs on a single record only.",
|
77
|
+
doctype: "Loanout",
|
78
|
+
supports_single_doc: "true",
|
79
|
+
supports_doc_list: "false",
|
80
|
+
supports_group: "false",
|
81
|
+
supports_no_context: "false",
|
82
|
+
filename: "LoansOut_List_Basic.jrxml",
|
83
|
+
mimetype: "application/pdf"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
name: "Acquisition Ethnographic Object List",
|
87
|
+
notes: "Core acquisition report. Runs on a single record only.",
|
88
|
+
doctype: "Acquisition",
|
89
|
+
supports_single_doc: "true",
|
90
|
+
supports_doc_list: "false",
|
91
|
+
supports_group: "false",
|
92
|
+
supports_no_context: "false",
|
93
|
+
filename: "coreAcquisition.jrxml",
|
94
|
+
mimetype: "application/pdf"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
name: "Group Object Ethnographic Object List",
|
98
|
+
notes: "Core group object report. Runs on a single record only.",
|
99
|
+
doctype: "Group",
|
100
|
+
supports_single_doc: "true",
|
101
|
+
supports_doc_list: "false",
|
102
|
+
supports_group: "false",
|
103
|
+
supports_no_context: "false",
|
104
|
+
filename: "coreGroupObject.jrxml",
|
105
|
+
mimetype: "application/pdf"
|
106
|
+
},
|
107
|
+
{
|
108
|
+
name: "Intake Ethnographic Object List",
|
109
|
+
notes: "Core intake report. Runs on a single record only.",
|
110
|
+
doctype: "Intake",
|
111
|
+
supports_single_doc: "true",
|
112
|
+
supports_doc_list: "false",
|
113
|
+
supports_group: "false",
|
114
|
+
supports_no_context: "false",
|
115
|
+
filename: "coreIntake.jrxml",
|
116
|
+
mimetype: "application/pdf"
|
117
|
+
},
|
118
|
+
{
|
119
|
+
name: "Loan In Ethnographic Object List",
|
120
|
+
notes: "Core loan in report. Runs on a single record only.",
|
121
|
+
doctype: "Loanin",
|
122
|
+
supports_single_doc: "true",
|
123
|
+
supports_doc_list: "false",
|
124
|
+
supports_group: "false",
|
125
|
+
supports_no_context: "false",
|
126
|
+
filename: "coreLoanIn.jrxml",
|
127
|
+
mimetype: "application/pdf"
|
128
|
+
},
|
129
|
+
{
|
130
|
+
name: "Loan Out Ethnographic Object List",
|
131
|
+
notes: "Core loan out report. Runs on a single record only.",
|
132
|
+
doctype: "Loanout",
|
133
|
+
supports_single_doc: "true",
|
134
|
+
supports_doc_list: "false",
|
135
|
+
supports_group: "false",
|
136
|
+
supports_no_context: "false",
|
137
|
+
filename: "coreLoanOut.jrxml",
|
138
|
+
mimetype: "application/pdf"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
name: "Object Exit Ethnographic Object List",
|
142
|
+
notes: "Core object exit report. Runs on a single record only.",
|
143
|
+
doctype: "ObjectExit",
|
144
|
+
supports_single_doc: "true",
|
145
|
+
supports_doc_list: "false",
|
146
|
+
supports_group: "false",
|
147
|
+
supports_no_context: "false",
|
148
|
+
filename: "coreObjectExit.jrxml",
|
149
|
+
mimetype: "application/pdf"
|
150
|
+
},
|
151
|
+
{
|
152
|
+
name: "Object Valuation",
|
153
|
+
notes: "Returns latest valuation information for selected objects",
|
154
|
+
doctype: "CollectionObject",
|
155
|
+
supports_single_doc: "false",
|
156
|
+
supports_doc_list: "true",
|
157
|
+
supports_group: "false",
|
158
|
+
supports_no_context: "true",
|
159
|
+
filename: "object_valuation.jrxml",
|
160
|
+
mimetype: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
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
|
+
end
|
175
|
+
|
176
|
+
def self.find(key, value)
|
177
|
+
all.find { |report| report[key] == value }
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CollectionSpace
|
2
4
|
# CollectionSpace request
|
3
5
|
class Request
|
@@ -9,21 +11,21 @@ module CollectionSpace
|
|
9
11
|
delete: {},
|
10
12
|
get: {},
|
11
13
|
post: {
|
12
|
-
|
13
|
-
|
14
|
+
"Content-Type" => "application/xml",
|
15
|
+
"Content-Length" => "nnnn"
|
14
16
|
},
|
15
17
|
put: {
|
16
|
-
|
17
|
-
|
18
|
+
"Content-Type" => "application/xml",
|
19
|
+
"Content-Length" => "nnnn"
|
18
20
|
}
|
19
21
|
}
|
20
22
|
headers[method]
|
21
23
|
end
|
22
24
|
|
23
|
-
def initialize(config, method =
|
25
|
+
def initialize(config, method = "GET", path = "", options = {})
|
24
26
|
@config = config
|
25
27
|
@method = method.downcase.to_sym
|
26
|
-
@path
|
28
|
+
@path = path.gsub(%r{^/}, "")
|
27
29
|
|
28
30
|
@auth = {
|
29
31
|
username: config.username,
|
@@ -33,11 +35,12 @@ module CollectionSpace
|
|
33
35
|
headers = default_headers(@method).merge(options.fetch(:headers, {}))
|
34
36
|
@options = options
|
35
37
|
@options[:basic_auth] = @auth
|
36
|
-
@options[:headers]
|
37
|
-
@options[:verify]
|
38
|
-
@options[:query]
|
38
|
+
@options[:headers] = headers
|
39
|
+
@options[:verify] = config.verify_ssl
|
40
|
+
@options[:query] = options.fetch(:query, {})
|
39
41
|
|
40
42
|
self.class.base_uri config.base_uri
|
43
|
+
self.class.debug_output $stdout if config.verbose
|
41
44
|
self.class.default_params(
|
42
45
|
wf_deleted: config.include_deleted,
|
43
46
|
pgSz: config.page_size
|
@@ -1,14 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CollectionSpace
|
2
4
|
# CollectionSpace response
|
3
5
|
class Response
|
4
6
|
attr_reader :result, :parsed, :status_code, :xml
|
5
7
|
|
6
8
|
def initialize(result)
|
7
|
-
@result
|
8
|
-
@parsed
|
9
|
+
@result = result
|
10
|
+
@parsed = result.parsed_response
|
9
11
|
@status_code = result.code.to_i
|
10
12
|
body = result.body
|
11
|
-
@xml = @result.success? && body =~ /<?xml/ ? Nokogiri::XML(body) : nil
|
13
|
+
@xml = (@result.success? && body =~ /<?xml/) ? Nokogiri::XML(body) : nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def find(list_type, item_type, property, value)
|
17
|
+
total = parsed[list_type]["totalItems"].to_i
|
18
|
+
return unless total.positive?
|
19
|
+
|
20
|
+
list = parsed[list_type][item_type]
|
21
|
+
list = [list] if total == 1 # wrap if single item
|
22
|
+
list.find { |i| i[property] == value }
|
12
23
|
end
|
13
24
|
end
|
14
25
|
end
|
@@ -1,12 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CollectionSpace
|
2
4
|
# CollectionSpace search
|
3
5
|
class Search
|
4
|
-
attr_accessor :path, :
|
6
|
+
attr_accessor :path, :namespace, :field, :expression
|
7
|
+
|
8
|
+
DEFAULT_SORT = "collectionspace_core:updatedAt DESC"
|
5
9
|
|
6
|
-
def initialize(path: nil,
|
7
|
-
@path
|
8
|
-
@
|
9
|
-
@field
|
10
|
+
def initialize(path: nil, namespace: nil, field: nil, expression: nil)
|
11
|
+
@path = path
|
12
|
+
@namespace = namespace
|
13
|
+
@field = field
|
10
14
|
@expression = expression
|
11
15
|
end
|
12
16
|
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CollectionSpace
|
4
|
+
# CollectionSpace service
|
5
|
+
class Service
|
6
|
+
TERM_SUFFIX = "TermGroupList/0/termDisplayName"
|
7
|
+
def self.get(type:, subtype: "")
|
8
|
+
{
|
9
|
+
"acquisitions" => {
|
10
|
+
identifier: "acquisitionReferenceNumber",
|
11
|
+
ns_prefix: "acquisitions",
|
12
|
+
path: "acquisitions",
|
13
|
+
term: nil
|
14
|
+
},
|
15
|
+
"citationauthorities" => {
|
16
|
+
identifier: "shortIdentifier",
|
17
|
+
ns_prefix: "citations",
|
18
|
+
path: "citationauthorities/urn:cspace:name(#{subtype})/items",
|
19
|
+
term: "citation#{TERM_SUFFIX}"
|
20
|
+
},
|
21
|
+
"claims" => {
|
22
|
+
identifier: "claimNumber",
|
23
|
+
ns_prefix: "claims",
|
24
|
+
path: "claims",
|
25
|
+
term: nil
|
26
|
+
},
|
27
|
+
"collectionobjects" => {
|
28
|
+
identifier: "objectNumber",
|
29
|
+
ns_prefix: "collectionobjects",
|
30
|
+
path: "collectionobjects",
|
31
|
+
term: nil
|
32
|
+
},
|
33
|
+
"conceptauthorities" => {
|
34
|
+
identifier: "shortIdentifier",
|
35
|
+
ns_prefix: "concepts",
|
36
|
+
path: "conceptauthorities/urn:cspace:name(#{subtype})/items",
|
37
|
+
term: "concept#{TERM_SUFFIX}"
|
38
|
+
},
|
39
|
+
"conditionchecks" => {
|
40
|
+
identifier: "conditionCheckRefNumber",
|
41
|
+
ns_prefix: "conditionchecks",
|
42
|
+
path: "conditionchecks",
|
43
|
+
term: nil
|
44
|
+
},
|
45
|
+
"conservation" => {
|
46
|
+
identifier: "conservationNumber",
|
47
|
+
ns_prefix: "conservation",
|
48
|
+
path: "conservation",
|
49
|
+
term: nil
|
50
|
+
},
|
51
|
+
"exhibitions" => {
|
52
|
+
identifier: "exhibitionNumber",
|
53
|
+
ns_prefix: "exhibitions",
|
54
|
+
path: "exhibitions",
|
55
|
+
term: nil
|
56
|
+
},
|
57
|
+
"groups" => {
|
58
|
+
identifier: "title",
|
59
|
+
ns_prefix: "groups",
|
60
|
+
path: "groups",
|
61
|
+
term: nil
|
62
|
+
},
|
63
|
+
"insurances" => {
|
64
|
+
identifier: "insuranceIndemnityReferenceNumber",
|
65
|
+
ns_prefix: "insurances",
|
66
|
+
path: "insurances",
|
67
|
+
term: nil
|
68
|
+
},
|
69
|
+
"intakes" => {
|
70
|
+
identifier: "entryNumber",
|
71
|
+
ns_prefix: "intakes",
|
72
|
+
path: "intakes",
|
73
|
+
term: nil
|
74
|
+
},
|
75
|
+
"iterationreports" => {
|
76
|
+
identifier: "iterationIdentificationNumber",
|
77
|
+
ns_prefix: "iterationreports",
|
78
|
+
path: "iterationreports",
|
79
|
+
term: nil
|
80
|
+
},
|
81
|
+
"loansin" => {
|
82
|
+
identifier: "loanInNumber",
|
83
|
+
ns_prefix: "loansin",
|
84
|
+
path: "loansin",
|
85
|
+
term: nil
|
86
|
+
},
|
87
|
+
"loansout" => {
|
88
|
+
identifier: "loanOutNumber",
|
89
|
+
ns_prefix: "loansout",
|
90
|
+
path: "loansout",
|
91
|
+
term: nil
|
92
|
+
},
|
93
|
+
"locationauthorities" => {
|
94
|
+
identifier: "shortIdentifier",
|
95
|
+
ns_prefix: "locations",
|
96
|
+
path: "locationauthorities/urn:cspace:name(#{subtype})/items",
|
97
|
+
term: "loc#{TERM_SUFFIX}"
|
98
|
+
},
|
99
|
+
"materialauthorities" => {
|
100
|
+
identifier: "shortIdentifier",
|
101
|
+
ns_prefix: "materials",
|
102
|
+
path: "materialauthorities/urn:cspace:name(#{subtype})/items",
|
103
|
+
term: "material#{TERM_SUFFIX}"
|
104
|
+
},
|
105
|
+
"media" => {
|
106
|
+
identifier: "identificationNumber",
|
107
|
+
ns_prefix: "media",
|
108
|
+
path: "media",
|
109
|
+
term: nil
|
110
|
+
},
|
111
|
+
"movements" => {
|
112
|
+
identifier: "movementReferenceNumber",
|
113
|
+
ns_prefix: "movements",
|
114
|
+
path: "movements",
|
115
|
+
term: nil
|
116
|
+
},
|
117
|
+
"objectexit" => {
|
118
|
+
identifier: "exitNumber",
|
119
|
+
ns_prefix: "objectexit",
|
120
|
+
path: "objectexit",
|
121
|
+
term: nil
|
122
|
+
},
|
123
|
+
"orgauthorities" => {
|
124
|
+
identifier: "shortIdentifier",
|
125
|
+
ns_prefix: "organizations",
|
126
|
+
path: "orgauthorities/urn:cspace:name(#{subtype})/items",
|
127
|
+
term: "org#{TERM_SUFFIX}"
|
128
|
+
},
|
129
|
+
"osteology" => {
|
130
|
+
identifier: "InventoryID",
|
131
|
+
ns_prefix: "osteology",
|
132
|
+
path: "osteology",
|
133
|
+
term: nil
|
134
|
+
},
|
135
|
+
"personauthorities" => {
|
136
|
+
identifier: "shortIdentifier",
|
137
|
+
ns_prefix: "persons",
|
138
|
+
path: "personauthorities/urn:cspace:name(#{subtype})/items",
|
139
|
+
term: "person#{TERM_SUFFIX}"
|
140
|
+
},
|
141
|
+
"placeauthorities" => {
|
142
|
+
identifier: "shortIdentifier",
|
143
|
+
ns_prefix: "places",
|
144
|
+
path: "placeauthorities/urn:cspace:name(#{subtype})/items",
|
145
|
+
term: "place#{TERM_SUFFIX}"
|
146
|
+
},
|
147
|
+
"pottags" => {
|
148
|
+
identifier: "potTagNumber",
|
149
|
+
ns_prefix: "pottags",
|
150
|
+
path: "pottags",
|
151
|
+
term: nil
|
152
|
+
},
|
153
|
+
"propagations" => {
|
154
|
+
identifier: "propNumber",
|
155
|
+
ns_prefix: "propagations",
|
156
|
+
path: "propagations",
|
157
|
+
term: nil
|
158
|
+
},
|
159
|
+
"relations" => {
|
160
|
+
identifier: "csid",
|
161
|
+
ns_prefix: "relations",
|
162
|
+
path: "relations",
|
163
|
+
term: nil
|
164
|
+
},
|
165
|
+
"taxonomyauthority" => {
|
166
|
+
identifier: "shortIdentifier",
|
167
|
+
ns_prefix: "taxon",
|
168
|
+
path: "taxonomyauthority/urn:cspace:name(#{subtype})/items",
|
169
|
+
term: "taxon#{TERM_SUFFIX}"
|
170
|
+
},
|
171
|
+
"transports" => {
|
172
|
+
identifier: "transportReferenceNumber",
|
173
|
+
ns_prefix: "transports",
|
174
|
+
path: "transports",
|
175
|
+
term: nil
|
176
|
+
},
|
177
|
+
"uoc" => {
|
178
|
+
identifier: "referenceNumber",
|
179
|
+
ns_prefix: "uoc",
|
180
|
+
path: "uoc",
|
181
|
+
term: nil
|
182
|
+
},
|
183
|
+
"valuationcontrols" => {
|
184
|
+
identifier: "valuationcontrolRefNumber",
|
185
|
+
ns_prefix: "valuationcontrols",
|
186
|
+
path: "valuationcontrols",
|
187
|
+
term: nil
|
188
|
+
},
|
189
|
+
"vocabularies" => {
|
190
|
+
identifier: "shortIdentifier",
|
191
|
+
ns_prefix: "vocabularyitems",
|
192
|
+
path: "vocabularies/urn:cspace:name(#{subtype})/items",
|
193
|
+
term: "displayName"
|
194
|
+
},
|
195
|
+
"workauthorities" => {
|
196
|
+
identifier: "shortIdentifier",
|
197
|
+
ns_prefix: "works",
|
198
|
+
path: "workauthorities/urn:cspace:name(#{subtype})/items",
|
199
|
+
term: "work#{TERM_SUFFIX}"
|
200
|
+
}
|
201
|
+
}.fetch(type)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CollectionSpace
|
4
|
+
module Template
|
5
|
+
def self.list
|
6
|
+
Dir.glob File.join(templates_path, "*.erb")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.process(template, data)
|
10
|
+
t = ERB.new(read(template))
|
11
|
+
r = t.result(binding).squeeze("\n")
|
12
|
+
Nokogiri::XML.parse(r).to_xml
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.read(file)
|
16
|
+
File.read("#{templates_path}/#{file}.xml.erb")
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.templates_path
|
20
|
+
ENV.fetch(
|
21
|
+
"COLLECTIONSPACE_CLIENT_TEMPLATES_PATH",
|
22
|
+
File.join(File.dirname(File.expand_path(__FILE__)), "templates")
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
2
|
+
<ns2:invocationContext xmlns:ns2="http://collectionspace.org/services/common/invocable">
|
3
|
+
<mode>list</mode>
|
4
|
+
<docType><%= data[:doctype] %></docType>
|
5
|
+
<listCSIDs>
|
6
|
+
<% data[:csids].each do |csid| %>
|
7
|
+
<csid><%= csid %></csid>
|
8
|
+
<% end %>
|
9
|
+
</listCSIDs>
|
10
|
+
</ns2:invocationContext>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
2
|
+
<document name="batch">
|
3
|
+
<ns2:batch_common xmlns:ns2="http://collectionspace.org/services/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
4
|
+
<name>Reindex Full Text</name>
|
5
|
+
<notes>Recomputes the indexed full text of all or specified records.</notes>
|
6
|
+
<className>org.collectionspace.services.batch.nuxeo.ReindexFullTextBatchJob</className>
|
7
|
+
<supportsNoContext>true</supportsNoContext>
|
8
|
+
<supportsSingleDoc>true</supportsSingleDoc>
|
9
|
+
<supportsDocList>true</supportsDocList>
|
10
|
+
<supportsGroup>false</supportsGroup>
|
11
|
+
<createsNewFocus>false</createsNewFocus>
|
12
|
+
<forDocTypes>
|
13
|
+
<forDocType>Acquisition</forDocType>
|
14
|
+
<forDocType>Batch</forDocType>
|
15
|
+
<forDocType>Blob</forDocType>
|
16
|
+
<forDocType>Citation</forDocType>
|
17
|
+
<forDocType>Citationauthority</forDocType>
|
18
|
+
<forDocType>Claim</forDocType>
|
19
|
+
<forDocType>CollectionObject</forDocType>
|
20
|
+
<forDocType>Conceptauthority</forDocType>
|
21
|
+
<forDocType>Conceptitem</forDocType>
|
22
|
+
<forDocType>Contact</forDocType>
|
23
|
+
<forDocType>Dimension</forDocType>
|
24
|
+
<forDocType>Group</forDocType>
|
25
|
+
<forDocType>Intake</forDocType>
|
26
|
+
<forDocType>Loanin</forDocType>
|
27
|
+
<forDocType>Loanout</forDocType>
|
28
|
+
<forDocType>Locationauthority</forDocType>
|
29
|
+
<forDocType>Locationitem</forDocType>
|
30
|
+
<forDocType>Media</forDocType>
|
31
|
+
<forDocType>Movement</forDocType>
|
32
|
+
<forDocType>ObjectExit</forDocType>
|
33
|
+
<forDocType>Organization</forDocType>
|
34
|
+
<forDocType>Orgauthority</forDocType>
|
35
|
+
<forDocType>Osteology</forDocType>
|
36
|
+
<forDocType>Person</forDocType>
|
37
|
+
<forDocType>Personauthority</forDocType>
|
38
|
+
<forDocType>Placeauthority</forDocType>
|
39
|
+
<forDocType>Placeitem</forDocType>
|
40
|
+
<forDocType>PublicItem</forDocType>
|
41
|
+
<forDocType>Relation</forDocType>
|
42
|
+
<forDocType>Report</forDocType>
|
43
|
+
<forDocType>Taxon</forDocType>
|
44
|
+
<forDocType>Taxonomyauthority</forDocType>
|
45
|
+
<forDocType>Vocabulary</forDocType>
|
46
|
+
<forDocType>Vocabularyitem</forDocType>
|
47
|
+
<forDocType>Workauthority</forDocType>
|
48
|
+
<forDocType>Workitem</forDocType>
|
49
|
+
</forDocTypes>
|
50
|
+
</ns2:batch_common>
|
51
|
+
</document>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<document name="reports">
|
3
|
+
<ns2:reports_common xmlns:ns2="http://collectionspace.org/services/report">
|
4
|
+
<name><%= data.fetch(:name) %></name>
|
5
|
+
<notes><%= data.fetch(:notes, data[:name]) %></notes>
|
6
|
+
<forDocTypes>
|
7
|
+
<forDocType><%= data.fetch(:doctype) %></forDocType>
|
8
|
+
</forDocTypes>
|
9
|
+
<supportsSingleDoc><%= data.fetch(:supports_single_doc, 'true') %></supportsSingleDoc>
|
10
|
+
<supportsDocList><%= data.fetch(:supports_doc_list, 'false') %></supportsDocList>
|
11
|
+
<supportsGroup><%= data.fetch(:supports_group, 'false') %></supportsGroup>
|
12
|
+
<supportsNoContext><%= data.fetch(:supports_no_context, 'true') %></supportsNoContext>
|
13
|
+
<filename><%= data.fetch(:filename) %></filename>
|
14
|
+
<outputMIME><%= data.fetch(:mimetype, 'application/pdf') %></outputMIME>
|
15
|
+
</ns2:reports_common>
|
16
|
+
</document>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<document name="media">
|
3
|
+
<ns2:media_common xmlns:ns2="http://collectionspace.org/services/media" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
4
|
+
<identificationNumber><%= data[:id] %></identificationNumber>
|
5
|
+
</ns2:media_common>
|
6
|
+
</document>
|