collectionspace-client 0.1.5 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish.yml +42 -0
  3. data/.gitignore +4 -0
  4. data/.rubocop.yml +8 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +2 -0
  7. data/README.md +19 -65
  8. data/Rakefile +44 -3
  9. data/bin/console +26 -0
  10. data/bin/rspec +29 -0
  11. data/collectionspace-client.gemspec +21 -19
  12. data/examples/demo.rb +14 -13
  13. data/examples/media_with_external_file.rb +20 -18
  14. data/examples/purge_empty_vocabs.rb +22 -0
  15. data/examples/reports.rb +178 -0
  16. data/examples/search.rb +25 -58
  17. data/examples/update_password.rb +3 -0
  18. data/lib/collectionspace/client/client.rb +19 -14
  19. data/lib/collectionspace/client/configuration.rb +16 -17
  20. data/lib/collectionspace/client/helpers.rb +145 -99
  21. data/lib/collectionspace/client/refname.rb +114 -0
  22. data/lib/collectionspace/client/request.rb +17 -13
  23. data/lib/collectionspace/client/response.rb +15 -10
  24. data/lib/collectionspace/client/search.rb +12 -7
  25. data/lib/collectionspace/client/service.rb +198 -0
  26. data/lib/collectionspace/client/template.rb +26 -0
  27. data/lib/collectionspace/client/templates/reindex_by_csids.xml.erb +10 -0
  28. data/lib/collectionspace/client/templates/reindex_by_doctype.xml.erb +5 -0
  29. data/lib/collectionspace/client/templates/reindex_full_text.xml.erb +51 -0
  30. data/lib/collectionspace/client/templates/report.xml.erb +16 -0
  31. data/lib/collectionspace/client/templates/reset_media_blob.xml.erb +6 -0
  32. data/lib/collectionspace/client/version.rb +3 -1
  33. data/lib/collectionspace/client.rb +20 -11
  34. metadata +64 -9
  35. data/examples/export.rb +0 -31
  36. data/examples/purge-empty-vocabularies.rb +0 -17
@@ -1,20 +1,25 @@
1
- module CollectionSpace
1
+ # frozen_string_literal: true
2
2
 
3
+ module CollectionSpace
4
+ # CollectionSpace response
3
5
  class Response
4
- attr_reader :result, :parsed, :body, :headers, :status, :status_code, :xml
6
+ attr_reader :result, :parsed, :status_code, :xml
5
7
 
6
8
  def initialize(result)
7
- # throw error
8
9
  @result = result
9
10
  @parsed = result.parsed_response
10
- @body = result.body
11
- @headers = result.headers
12
- @status = result.response
13
11
  @status_code = result.code.to_i
14
-
15
- @xml = (@status_code.to_s =~ /^2/ and @body =~ /<?xml/) ? Nokogiri::XML(@body) : nil
12
+ body = result.body
13
+ @xml = @result.success? && body =~ /<?xml/ ? Nokogiri::XML(body) : nil
16
14
  end
17
15
 
18
- end
16
+ def find(list_type, item_type, property, value)
17
+ total = parsed[list_type]['totalItems'].to_i
18
+ return unless total.positive?
19
19
 
20
- end
20
+ list = parsed[list_type][item_type]
21
+ list = [list] if total == 1 # wrap if single item
22
+ list.find { |i| i[property] == value }
23
+ end
24
+ end
25
+ end
@@ -1,10 +1,17 @@
1
- module CollectionSpace
1
+ # frozen_string_literal: true
2
2
 
3
+ module CollectionSpace
4
+ # CollectionSpace search
3
5
  class Search
4
- attr_accessor :path, :type, :field, :expression
6
+ attr_accessor :path, :namespace, :field, :expression
7
+
8
+ DEFAULT_SORT = 'collectionspace_core:updatedAt DESC'
5
9
 
6
- def initialize(path: nil, type: nil, field: nil, expression: nil)
7
- @path, @type, @field, @expression = path, type, field, expression
10
+ def initialize(path: nil, namespace: nil, field: nil, expression: nil)
11
+ @path = path
12
+ @namespace = namespace
13
+ @field = field
14
+ @expression = expression
8
15
  end
9
16
 
10
17
  def from_hash(query)
@@ -13,7 +20,5 @@ module CollectionSpace
13
20
  end
14
21
  self
15
22
  end
16
-
17
23
  end
18
-
19
- end
24
+ end
@@ -0,0 +1,198 @@
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
+ 'loansin' => {
76
+ identifier: 'loanInNumber',
77
+ ns_prefix: 'loansin',
78
+ path: 'loansin',
79
+ term: nil
80
+ },
81
+ 'loansout' => {
82
+ identifier: 'loanOutNumber',
83
+ ns_prefix: 'loansout',
84
+ path: 'loansout',
85
+ term: nil
86
+ },
87
+ 'locationauthorities' => {
88
+ identifier: 'shortIdentifier',
89
+ ns_prefix: 'locations',
90
+ path: "locationauthorities/urn:cspace:name(#{subtype})/items",
91
+ term: "loc#{TERM_SUFFIX}"
92
+ },
93
+ 'materialauthorities' => {
94
+ identifier: 'shortIdentifier',
95
+ ns_prefix: 'materials',
96
+ path: "materialauthorities/urn:cspace:name(#{subtype})/items",
97
+ term: "material#{TERM_SUFFIX}"
98
+ },
99
+ 'media' => {
100
+ identifier: 'identificationNumber',
101
+ ns_prefix: 'media',
102
+ path: 'media',
103
+ term: nil
104
+ },
105
+ 'movements' => {
106
+ identifier: 'movementReferenceNumber',
107
+ ns_prefix: 'movements',
108
+ path: 'movements',
109
+ term: nil
110
+ },
111
+ 'objectexit' => {
112
+ identifier: 'exitNumber',
113
+ ns_prefix: 'objectexit',
114
+ path: 'objectexit',
115
+ term: nil
116
+ },
117
+ 'orgauthorities' => {
118
+ identifier: 'shortIdentifier',
119
+ ns_prefix: 'organizations',
120
+ path: "orgauthorities/urn:cspace:name(#{subtype})/items",
121
+ term: "org#{TERM_SUFFIX}"
122
+ },
123
+ 'osteology' => {
124
+ identifier: 'InventoryID',
125
+ ns_prefix: 'osteology',
126
+ path: 'osteology',
127
+ term: nil
128
+ },
129
+ 'personauthorities' => {
130
+ identifier: 'shortIdentifier',
131
+ ns_prefix: 'persons',
132
+ path: "personauthorities/urn:cspace:name(#{subtype})/items",
133
+ term: "person#{TERM_SUFFIX}"
134
+ },
135
+ 'placeauthorities' => {
136
+ identifier: 'shortIdentifier',
137
+ ns_prefix: 'places',
138
+ path: "placeauthorities/urn:cspace:name(#{subtype})/items",
139
+ term: "place#{TERM_SUFFIX}"
140
+ },
141
+ 'pottags' => {
142
+ identifier: 'potTagNumber',
143
+ ns_prefix: 'pottags',
144
+ path: 'pottags',
145
+ term: nil
146
+ },
147
+ 'propagations' => {
148
+ identifier: 'propNumber',
149
+ ns_prefix: 'propagations',
150
+ path: 'propagations',
151
+ term: nil
152
+ },
153
+ 'relations' => {
154
+ identifier: 'csid',
155
+ ns_prefix: 'relations',
156
+ path: 'relations',
157
+ term: nil
158
+ },
159
+ 'taxonomyauthority' => {
160
+ identifier: 'shortIdentifier',
161
+ ns_prefix: 'taxon',
162
+ path: "taxonomyauthority/urn:cspace:name(#{subtype})/items",
163
+ term: "taxon#{TERM_SUFFIX}"
164
+ },
165
+ 'transports' => {
166
+ identifier: 'transportReferenceNumber',
167
+ ns_prefix: 'transports',
168
+ path: 'transports',
169
+ term: nil
170
+ },
171
+ 'uoc' => {
172
+ identifier: 'referenceNumber',
173
+ ns_prefix: 'uoc',
174
+ path: 'uoc',
175
+ term: nil
176
+ },
177
+ 'valuationcontrols' => {
178
+ identifier: 'valuationcontrolRefNumber',
179
+ ns_prefix: 'valuationcontrols',
180
+ path: 'valuationcontrols',
181
+ term: nil
182
+ },
183
+ 'vocabularies' => {
184
+ identifier: 'shortIdentifier',
185
+ ns_prefix: 'vocabularyitems',
186
+ path: "vocabularies/urn:cspace:name(#{subtype})/items",
187
+ term: 'displayName'
188
+ },
189
+ 'workauthorities' => {
190
+ identifier: 'shortIdentifier',
191
+ ns_prefix: 'works',
192
+ path: "workauthorities/urn:cspace:name(#{subtype})/items",
193
+ term: "work#{TERM_SUFFIX}"
194
+ }
195
+ }.fetch(type)
196
+ end
197
+ end
198
+ 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).gsub(/\n+/, "\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,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,5 @@
1
+ <?xml version="1.0" encoding="utf-8" standalone="yes"?>
2
+ <ns2:invocationContext xmlns:ns2="http://collectionspace.org/services/common/invocable">
3
+ <mode>nocontext</mode>
4
+ <docType><%= data[:doctype] %></docType>
5
+ </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>
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CollectionSpace
2
4
  class Client
3
- VERSION = "0.1.5"
5
+ VERSION = '0.14.1'
4
6
  end
5
7
  end
@@ -1,21 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'httparty'
2
4
  require 'nokogiri'
3
5
  require 'uri'
4
6
 
5
7
  # mixins required first
6
- require "collectionspace/client/helpers"
8
+ require 'collectionspace/client/helpers'
9
+ require 'collectionspace/client/template'
7
10
 
8
- require "collectionspace/client/client"
9
- require "collectionspace/client/configuration"
10
- require "collectionspace/client/request"
11
- require "collectionspace/client/response"
12
- require "collectionspace/client/search"
13
- require "collectionspace/client/version"
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'
14
19
 
15
20
  module CollectionSpace
21
+ class ArgumentError < StandardError; end
22
+
23
+ class DuplicateIdFound < StandardError; end
24
+
25
+ class NotFoundError < StandardError; end
16
26
 
17
- class ArgumentError < Exception ; end
18
- class PayloadError < Exception ; end
19
- class RequestError < Exception ; end
27
+ class PayloadError < StandardError; end
20
28
 
21
- end
29
+ class RequestError < StandardError; end
30
+ 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.1.5
4
+ version: 0.14.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: 2019-05-22 00:00:00.000000000 Z
11
+ date: 2022-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: awesome_print
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +123,7 @@ dependencies:
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: vcr
126
+ name: rubocop
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - ">="
@@ -109,7 +137,21 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
- name: webmock
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.21'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.21'
153
+ - !ruby/object:Gem::Dependency
154
+ name: vcr
113
155
  requirement: !ruby/object:Gem::Requirement
114
156
  requirements:
115
157
  - - ">="
@@ -123,7 +165,7 @@ dependencies:
123
165
  - !ruby/object:Gem::Version
124
166
  version: '0'
125
167
  - !ruby/object:Gem::Dependency
126
- name: awesome_print
168
+ name: webmock
127
169
  requirement: !ruby/object:Gem::Requirement
128
170
  requirements:
129
171
  - - ">="
@@ -143,26 +185,40 @@ executables: []
143
185
  extensions: []
144
186
  extra_rdoc_files: []
145
187
  files:
188
+ - ".github/workflows/publish.yml"
146
189
  - ".gitignore"
147
190
  - ".rspec"
191
+ - ".rubocop.yml"
192
+ - ".ruby-version"
148
193
  - ".travis.yml"
149
194
  - Gemfile
150
195
  - LICENSE.txt
151
196
  - README.md
152
197
  - Rakefile
198
+ - bin/console
199
+ - bin/rspec
153
200
  - collectionspace-client.gemspec
154
201
  - examples/demo.rb
155
- - examples/export.rb
156
202
  - examples/media_with_external_file.rb
157
- - examples/purge-empty-vocabularies.rb
203
+ - examples/purge_empty_vocabs.rb
204
+ - examples/reports.rb
158
205
  - examples/search.rb
206
+ - examples/update_password.rb
159
207
  - lib/collectionspace/client.rb
160
208
  - lib/collectionspace/client/client.rb
161
209
  - lib/collectionspace/client/configuration.rb
162
210
  - lib/collectionspace/client/helpers.rb
211
+ - lib/collectionspace/client/refname.rb
163
212
  - lib/collectionspace/client/request.rb
164
213
  - lib/collectionspace/client/response.rb
165
214
  - lib/collectionspace/client/search.rb
215
+ - lib/collectionspace/client/service.rb
216
+ - lib/collectionspace/client/template.rb
217
+ - lib/collectionspace/client/templates/reindex_by_csids.xml.erb
218
+ - lib/collectionspace/client/templates/reindex_by_doctype.xml.erb
219
+ - lib/collectionspace/client/templates/reindex_full_text.xml.erb
220
+ - lib/collectionspace/client/templates/report.xml.erb
221
+ - lib/collectionspace/client/templates/reset_media_blob.xml.erb
166
222
  - lib/collectionspace/client/version.rb
167
223
  homepage: https://github.com/lyrasis/collectionspace-client.git
168
224
  licenses:
@@ -183,8 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
239
  - !ruby/object:Gem::Version
184
240
  version: '0'
185
241
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.7.6
242
+ rubygems_version: 3.3.18
188
243
  signing_key:
189
244
  specification_version: 4
190
245
  summary: CollectionSpace API client.
data/examples/export.rb DELETED
@@ -1,31 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'awesome_print'
3
- require 'collectionspace/client'
4
- require 'date'
5
-
6
- # MONKEY PATCHING FOR RAILS LIKE 3.days.ago
7
- class Fixnum
8
- SECONDS_IN_DAY = 24 * 60 * 60
9
-
10
- def days
11
- self * SECONDS_IN_DAY
12
- end
13
-
14
- def ago
15
- Time.now - self
16
- end
17
- end
18
-
19
- # CREATE CLIENT WITH DEFAULT (DEMO) CONFIGURATION -- BE NICE!!!
20
- client = CollectionSpace::Client.new
21
- client.config.throttle = 1
22
-
23
- # GET ALL CATALOGING RECORDS AND DUMP THE XML IF UPDATED SINCE 3 DAYS AGO
24
- client.all('collectionobjects').each do |item|
25
- updated = Date.parse item["updatedAt"]
26
- if updated > Date.parse(14.days.ago.to_s)
27
- collectionobject = client.get item["uri"]
28
- # TO EXPORT WRITE THE BODY TO FILE, HERE WE JUST PRINT IT
29
- ap collectionobject.body # OR .xml.to_s
30
- end
31
- end
@@ -1,17 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'awesome_print'
3
- require 'collectionspace/client'
4
-
5
- # CREATE CLIENT WITH DEFAULT (DEMO) CONFIGURATION -- BE NICE!!!
6
- client = CollectionSpace::Client.new
7
- client.config.throttle = 1
8
-
9
- client.all('vocabularies').each do |item|
10
- uri = item["uri"]
11
- puts "Checking vocabulary: #{uri}"
12
- if client.count("#{uri}/items") == 0
13
- puts "Purging empty vocabulary:\t#{item['displayName']} (#{item['csid']})"
14
- # YOU WOULD UNCOMMENT THIS TO ACTUALLY PERFORM THE PURGE ...
15
- # client.delete uri
16
- end
17
- end