collectionspace-client 0.14.1 → 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/.gitignore +2 -0
- data/.rubocop.yml +4 -8
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/Rakefile +12 -11
- data/bin/console +6 -6
- data/bin/rspec +1 -1
- data/collectionspace-client.gemspec +26 -25
- data/examples/batches.rb +50 -0
- data/examples/demo.rb +8 -8
- data/examples/media_with_external_file.rb +9 -9
- data/examples/purge_empty_vocabs.rb +8 -8
- data/examples/reports.rb +36 -169
- data/examples/reset_media_blob.rb +35 -0
- data/examples/search.rb +15 -15
- data/examples/update_password.rb +1 -1
- data/lib/collectionspace/client/batch.rb +55 -0
- data/lib/collectionspace/client/client.rb +16 -5
- data/lib/collectionspace/client/configuration.rb +2 -1
- data/lib/collectionspace/client/helpers.rb +107 -46
- data/lib/collectionspace/client/refname.rb +22 -22
- data/lib/collectionspace/client/report.rb +180 -0
- data/lib/collectionspace/client/request.rb +10 -9
- data/lib/collectionspace/client/response.rb +6 -6
- data/lib/collectionspace/client/search.rb +4 -4
- data/lib/collectionspace/client/service.rb +123 -117
- data/lib/collectionspace/client/template.rb +4 -4
- data/lib/collectionspace/client/templates/batch.xml.erb +18 -0
- data/lib/collectionspace/client/version.rb +1 -1
- data/lib/collectionspace/client.rb +18 -16
- metadata +27 -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
|
@@ -11,21 +11,21 @@ module CollectionSpace
|
|
11
11
|
delete: {},
|
12
12
|
get: {},
|
13
13
|
post: {
|
14
|
-
|
15
|
-
|
14
|
+
"Content-Type" => "application/xml",
|
15
|
+
"Content-Length" => "nnnn"
|
16
16
|
},
|
17
17
|
put: {
|
18
|
-
|
19
|
-
|
18
|
+
"Content-Type" => "application/xml",
|
19
|
+
"Content-Length" => "nnnn"
|
20
20
|
}
|
21
21
|
}
|
22
22
|
headers[method]
|
23
23
|
end
|
24
24
|
|
25
|
-
def initialize(config, method =
|
25
|
+
def initialize(config, method = "GET", path = "", options = {})
|
26
26
|
@config = config
|
27
27
|
@method = method.downcase.to_sym
|
28
|
-
@path
|
28
|
+
@path = path.gsub(%r{^/}, "")
|
29
29
|
|
30
30
|
@auth = {
|
31
31
|
username: config.username,
|
@@ -35,11 +35,12 @@ module CollectionSpace
|
|
35
35
|
headers = default_headers(@method).merge(options.fetch(:headers, {}))
|
36
36
|
@options = options
|
37
37
|
@options[:basic_auth] = @auth
|
38
|
-
@options[:headers]
|
39
|
-
@options[:verify]
|
40
|
-
@options[:query]
|
38
|
+
@options[:headers] = headers
|
39
|
+
@options[:verify] = config.verify_ssl
|
40
|
+
@options[:query] = options.fetch(:query, {})
|
41
41
|
|
42
42
|
self.class.base_uri config.base_uri
|
43
|
+
self.class.debug_output $stdout if config.verbose
|
43
44
|
self.class.default_params(
|
44
45
|
wf_deleted: config.include_deleted,
|
45
46
|
pgSz: config.page_size
|
@@ -6,19 +6,19 @@ module CollectionSpace
|
|
6
6
|
attr_reader :result, :parsed, :status_code, :xml
|
7
7
|
|
8
8
|
def initialize(result)
|
9
|
-
@result
|
10
|
-
@parsed
|
9
|
+
@result = result
|
10
|
+
@parsed = result.parsed_response
|
11
11
|
@status_code = result.code.to_i
|
12
12
|
body = result.body
|
13
|
-
@xml = @result.success? && body =~ /<?xml/ ? Nokogiri::XML(body) : nil
|
13
|
+
@xml = (@result.success? && body =~ /<?xml/) ? Nokogiri::XML(body) : nil
|
14
14
|
end
|
15
15
|
|
16
16
|
def find(list_type, item_type, property, value)
|
17
|
-
total = parsed[list_type][
|
17
|
+
total = parsed[list_type]["totalItems"].to_i
|
18
18
|
return unless total.positive?
|
19
19
|
|
20
|
-
list
|
21
|
-
list
|
20
|
+
list = parsed[list_type][item_type]
|
21
|
+
list = [list] if total == 1 # wrap if single item
|
22
22
|
list.find { |i| i[property] == value }
|
23
23
|
end
|
24
24
|
end
|
@@ -5,12 +5,12 @@ module CollectionSpace
|
|
5
5
|
class Search
|
6
6
|
attr_accessor :path, :namespace, :field, :expression
|
7
7
|
|
8
|
-
DEFAULT_SORT =
|
8
|
+
DEFAULT_SORT = "collectionspace_core:updatedAt DESC"
|
9
9
|
|
10
10
|
def initialize(path: nil, namespace: nil, field: nil, expression: nil)
|
11
|
-
@path
|
12
|
-
@namespace
|
13
|
-
@field
|
11
|
+
@path = path
|
12
|
+
@namespace = namespace
|
13
|
+
@field = field
|
14
14
|
@expression = expression
|
15
15
|
end
|
16
16
|
|
@@ -3,192 +3,198 @@
|
|
3
3
|
module CollectionSpace
|
4
4
|
# CollectionSpace service
|
5
5
|
class Service
|
6
|
-
TERM_SUFFIX =
|
7
|
-
def self.get(type:, subtype:
|
6
|
+
TERM_SUFFIX = "TermGroupList/0/termDisplayName"
|
7
|
+
def self.get(type:, subtype: "")
|
8
8
|
{
|
9
|
-
|
10
|
-
identifier:
|
11
|
-
ns_prefix:
|
12
|
-
path:
|
9
|
+
"acquisitions" => {
|
10
|
+
identifier: "acquisitionReferenceNumber",
|
11
|
+
ns_prefix: "acquisitions",
|
12
|
+
path: "acquisitions",
|
13
13
|
term: nil
|
14
14
|
},
|
15
|
-
|
16
|
-
identifier:
|
17
|
-
ns_prefix:
|
15
|
+
"citationauthorities" => {
|
16
|
+
identifier: "shortIdentifier",
|
17
|
+
ns_prefix: "citations",
|
18
18
|
path: "citationauthorities/urn:cspace:name(#{subtype})/items",
|
19
19
|
term: "citation#{TERM_SUFFIX}"
|
20
20
|
},
|
21
|
-
|
22
|
-
identifier:
|
23
|
-
ns_prefix:
|
24
|
-
path:
|
21
|
+
"claims" => {
|
22
|
+
identifier: "claimNumber",
|
23
|
+
ns_prefix: "claims",
|
24
|
+
path: "claims",
|
25
25
|
term: nil
|
26
26
|
},
|
27
|
-
|
28
|
-
identifier:
|
29
|
-
ns_prefix:
|
30
|
-
path:
|
27
|
+
"collectionobjects" => {
|
28
|
+
identifier: "objectNumber",
|
29
|
+
ns_prefix: "collectionobjects",
|
30
|
+
path: "collectionobjects",
|
31
31
|
term: nil
|
32
32
|
},
|
33
|
-
|
34
|
-
identifier:
|
35
|
-
ns_prefix:
|
33
|
+
"conceptauthorities" => {
|
34
|
+
identifier: "shortIdentifier",
|
35
|
+
ns_prefix: "concepts",
|
36
36
|
path: "conceptauthorities/urn:cspace:name(#{subtype})/items",
|
37
37
|
term: "concept#{TERM_SUFFIX}"
|
38
38
|
},
|
39
|
-
|
40
|
-
identifier:
|
41
|
-
ns_prefix:
|
42
|
-
path:
|
39
|
+
"conditionchecks" => {
|
40
|
+
identifier: "conditionCheckRefNumber",
|
41
|
+
ns_prefix: "conditionchecks",
|
42
|
+
path: "conditionchecks",
|
43
43
|
term: nil
|
44
44
|
},
|
45
|
-
|
46
|
-
identifier:
|
47
|
-
ns_prefix:
|
48
|
-
path:
|
45
|
+
"conservation" => {
|
46
|
+
identifier: "conservationNumber",
|
47
|
+
ns_prefix: "conservation",
|
48
|
+
path: "conservation",
|
49
49
|
term: nil
|
50
50
|
},
|
51
|
-
|
52
|
-
identifier:
|
53
|
-
ns_prefix:
|
54
|
-
path:
|
51
|
+
"exhibitions" => {
|
52
|
+
identifier: "exhibitionNumber",
|
53
|
+
ns_prefix: "exhibitions",
|
54
|
+
path: "exhibitions",
|
55
55
|
term: nil
|
56
56
|
},
|
57
|
-
|
58
|
-
identifier:
|
59
|
-
ns_prefix:
|
60
|
-
path:
|
57
|
+
"groups" => {
|
58
|
+
identifier: "title",
|
59
|
+
ns_prefix: "groups",
|
60
|
+
path: "groups",
|
61
61
|
term: nil
|
62
62
|
},
|
63
|
-
|
64
|
-
identifier:
|
65
|
-
ns_prefix:
|
66
|
-
path:
|
63
|
+
"insurances" => {
|
64
|
+
identifier: "insuranceIndemnityReferenceNumber",
|
65
|
+
ns_prefix: "insurances",
|
66
|
+
path: "insurances",
|
67
67
|
term: nil
|
68
68
|
},
|
69
|
-
|
70
|
-
identifier:
|
71
|
-
ns_prefix:
|
72
|
-
path:
|
69
|
+
"intakes" => {
|
70
|
+
identifier: "entryNumber",
|
71
|
+
ns_prefix: "intakes",
|
72
|
+
path: "intakes",
|
73
73
|
term: nil
|
74
74
|
},
|
75
|
-
|
76
|
-
identifier:
|
77
|
-
ns_prefix:
|
78
|
-
path:
|
75
|
+
"iterationreports" => {
|
76
|
+
identifier: "iterationIdentificationNumber",
|
77
|
+
ns_prefix: "iterationreports",
|
78
|
+
path: "iterationreports",
|
79
79
|
term: nil
|
80
80
|
},
|
81
|
-
|
82
|
-
identifier:
|
83
|
-
ns_prefix:
|
84
|
-
path:
|
81
|
+
"loansin" => {
|
82
|
+
identifier: "loanInNumber",
|
83
|
+
ns_prefix: "loansin",
|
84
|
+
path: "loansin",
|
85
85
|
term: nil
|
86
86
|
},
|
87
|
-
|
88
|
-
identifier:
|
89
|
-
ns_prefix:
|
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",
|
90
96
|
path: "locationauthorities/urn:cspace:name(#{subtype})/items",
|
91
97
|
term: "loc#{TERM_SUFFIX}"
|
92
98
|
},
|
93
|
-
|
94
|
-
identifier:
|
95
|
-
ns_prefix:
|
99
|
+
"materialauthorities" => {
|
100
|
+
identifier: "shortIdentifier",
|
101
|
+
ns_prefix: "materials",
|
96
102
|
path: "materialauthorities/urn:cspace:name(#{subtype})/items",
|
97
103
|
term: "material#{TERM_SUFFIX}"
|
98
104
|
},
|
99
|
-
|
100
|
-
identifier:
|
101
|
-
ns_prefix:
|
102
|
-
path:
|
105
|
+
"media" => {
|
106
|
+
identifier: "identificationNumber",
|
107
|
+
ns_prefix: "media",
|
108
|
+
path: "media",
|
103
109
|
term: nil
|
104
110
|
},
|
105
|
-
|
106
|
-
identifier:
|
107
|
-
ns_prefix:
|
108
|
-
path:
|
111
|
+
"movements" => {
|
112
|
+
identifier: "movementReferenceNumber",
|
113
|
+
ns_prefix: "movements",
|
114
|
+
path: "movements",
|
109
115
|
term: nil
|
110
116
|
},
|
111
|
-
|
112
|
-
identifier:
|
113
|
-
ns_prefix:
|
114
|
-
path:
|
117
|
+
"objectexit" => {
|
118
|
+
identifier: "exitNumber",
|
119
|
+
ns_prefix: "objectexit",
|
120
|
+
path: "objectexit",
|
115
121
|
term: nil
|
116
122
|
},
|
117
|
-
|
118
|
-
identifier:
|
119
|
-
ns_prefix:
|
123
|
+
"orgauthorities" => {
|
124
|
+
identifier: "shortIdentifier",
|
125
|
+
ns_prefix: "organizations",
|
120
126
|
path: "orgauthorities/urn:cspace:name(#{subtype})/items",
|
121
127
|
term: "org#{TERM_SUFFIX}"
|
122
128
|
},
|
123
|
-
|
124
|
-
identifier:
|
125
|
-
ns_prefix:
|
126
|
-
path:
|
129
|
+
"osteology" => {
|
130
|
+
identifier: "InventoryID",
|
131
|
+
ns_prefix: "osteology",
|
132
|
+
path: "osteology",
|
127
133
|
term: nil
|
128
134
|
},
|
129
|
-
|
130
|
-
identifier:
|
131
|
-
ns_prefix:
|
135
|
+
"personauthorities" => {
|
136
|
+
identifier: "shortIdentifier",
|
137
|
+
ns_prefix: "persons",
|
132
138
|
path: "personauthorities/urn:cspace:name(#{subtype})/items",
|
133
139
|
term: "person#{TERM_SUFFIX}"
|
134
140
|
},
|
135
|
-
|
136
|
-
identifier:
|
137
|
-
ns_prefix:
|
141
|
+
"placeauthorities" => {
|
142
|
+
identifier: "shortIdentifier",
|
143
|
+
ns_prefix: "places",
|
138
144
|
path: "placeauthorities/urn:cspace:name(#{subtype})/items",
|
139
145
|
term: "place#{TERM_SUFFIX}"
|
140
146
|
},
|
141
|
-
|
142
|
-
identifier:
|
143
|
-
ns_prefix:
|
144
|
-
path:
|
147
|
+
"pottags" => {
|
148
|
+
identifier: "potTagNumber",
|
149
|
+
ns_prefix: "pottags",
|
150
|
+
path: "pottags",
|
145
151
|
term: nil
|
146
152
|
},
|
147
|
-
|
148
|
-
identifier:
|
149
|
-
ns_prefix:
|
150
|
-
path:
|
153
|
+
"propagations" => {
|
154
|
+
identifier: "propNumber",
|
155
|
+
ns_prefix: "propagations",
|
156
|
+
path: "propagations",
|
151
157
|
term: nil
|
152
158
|
},
|
153
|
-
|
154
|
-
identifier:
|
155
|
-
ns_prefix:
|
156
|
-
path:
|
159
|
+
"relations" => {
|
160
|
+
identifier: "csid",
|
161
|
+
ns_prefix: "relations",
|
162
|
+
path: "relations",
|
157
163
|
term: nil
|
158
164
|
},
|
159
|
-
|
160
|
-
identifier:
|
161
|
-
ns_prefix:
|
165
|
+
"taxonomyauthority" => {
|
166
|
+
identifier: "shortIdentifier",
|
167
|
+
ns_prefix: "taxon",
|
162
168
|
path: "taxonomyauthority/urn:cspace:name(#{subtype})/items",
|
163
169
|
term: "taxon#{TERM_SUFFIX}"
|
164
170
|
},
|
165
|
-
|
166
|
-
identifier:
|
167
|
-
ns_prefix:
|
168
|
-
path:
|
171
|
+
"transports" => {
|
172
|
+
identifier: "transportReferenceNumber",
|
173
|
+
ns_prefix: "transports",
|
174
|
+
path: "transports",
|
169
175
|
term: nil
|
170
176
|
},
|
171
|
-
|
172
|
-
identifier:
|
173
|
-
ns_prefix:
|
174
|
-
path:
|
177
|
+
"uoc" => {
|
178
|
+
identifier: "referenceNumber",
|
179
|
+
ns_prefix: "uoc",
|
180
|
+
path: "uoc",
|
175
181
|
term: nil
|
176
182
|
},
|
177
|
-
|
178
|
-
identifier:
|
179
|
-
ns_prefix:
|
180
|
-
path:
|
183
|
+
"valuationcontrols" => {
|
184
|
+
identifier: "valuationcontrolRefNumber",
|
185
|
+
ns_prefix: "valuationcontrols",
|
186
|
+
path: "valuationcontrols",
|
181
187
|
term: nil
|
182
188
|
},
|
183
|
-
|
184
|
-
identifier:
|
185
|
-
ns_prefix:
|
189
|
+
"vocabularies" => {
|
190
|
+
identifier: "shortIdentifier",
|
191
|
+
ns_prefix: "vocabularyitems",
|
186
192
|
path: "vocabularies/urn:cspace:name(#{subtype})/items",
|
187
|
-
term:
|
193
|
+
term: "displayName"
|
188
194
|
},
|
189
|
-
|
190
|
-
identifier:
|
191
|
-
ns_prefix:
|
195
|
+
"workauthorities" => {
|
196
|
+
identifier: "shortIdentifier",
|
197
|
+
ns_prefix: "works",
|
192
198
|
path: "workauthorities/urn:cspace:name(#{subtype})/items",
|
193
199
|
term: "work#{TERM_SUFFIX}"
|
194
200
|
}
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module CollectionSpace
|
4
4
|
module Template
|
5
5
|
def self.list
|
6
|
-
Dir.glob File.join(templates_path,
|
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).
|
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
|
-
|
22
|
-
File.join(File.dirname(File.expand_path(__FILE__)),
|
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>
|