libis-tools 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.travis.yml +37 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +289 -0
- data/Rakefile +6 -0
- data/lib/libis-tools.rb +1 -0
- data/lib/libis/tools.rb +16 -0
- data/lib/libis/tools/assert.rb +41 -0
- data/lib/libis/tools/checksum.rb +84 -0
- data/lib/libis/tools/command.rb +40 -0
- data/lib/libis/tools/config.rb +160 -0
- data/lib/libis/tools/dc_record.rb +47 -0
- data/lib/libis/tools/extend/empty.rb +7 -0
- data/lib/libis/tools/extend/hash.rb +107 -0
- data/lib/libis/tools/extend/ostruct.rb +3 -0
- data/lib/libis/tools/extend/string.rb +85 -0
- data/lib/libis/tools/extend/struct.rb +29 -0
- data/lib/libis/tools/logger.rb +71 -0
- data/lib/libis/tools/mets_file.rb +575 -0
- data/lib/libis/tools/parameter.rb +172 -0
- data/lib/libis/tools/sharepoint_mapping.rb +118 -0
- data/lib/libis/tools/sharepoint_record.rb +260 -0
- data/lib/libis/tools/version.rb +5 -0
- data/lib/libis/tools/xml_document.rb +574 -0
- data/libis-tools.gemspec +39 -0
- data/spec/assert_spec.rb +65 -0
- data/spec/checksum_spec.rb +132 -0
- data/spec/command_spec.rb +68 -0
- data/spec/config_spec.rb +86 -0
- data/spec/data/test.data +9 -0
- data/spec/data/test.xml +8 -0
- data/spec/data/test.yml +1 -0
- data/spec/logger_spec.rb +107 -0
- data/spec/parameter_container_spec.rb +83 -0
- data/spec/parameter_spec.rb +139 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/test.xsd +20 -0
- data/spec/xmldocument_spec.rb +413 -0
- data/test/test_helper.rb +7 -0
- data/test/webservices/test_ca_item_info.rb +59 -0
- data/test/webservices/test_ca_search.rb +35 -0
- metadata +244 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../test_helper'
|
3
|
+
|
4
|
+
class TestCaItemInfo < Test::Unit::TestCase
|
5
|
+
|
6
|
+
# Called before every test method runs. Can be used
|
7
|
+
# to set up fixture information.
|
8
|
+
def setup
|
9
|
+
|
10
|
+
@ca_client = ::Libis::Tools::Webservices::CollectiveAccess.new
|
11
|
+
@ca_client.authenticate
|
12
|
+
@object_label = 'TEST.0001.0001'
|
13
|
+
@object = @ca_client.add_object @object_label
|
14
|
+
@attributes = {
|
15
|
+
digitoolUrl: %w(abcdefgh 172 DigitoolUrl),
|
16
|
+
objectHistoriek: %w(blablabla 84 Text),
|
17
|
+
objectBeschrijving: %w(zxcvbnm 91 Text)
|
18
|
+
}
|
19
|
+
@attributes.each { |k, v|
|
20
|
+
@ca_client.add_attribute @object, k, v[0]
|
21
|
+
}
|
22
|
+
|
23
|
+
@client ||= CaItemInfo.new()
|
24
|
+
@client.authenticate
|
25
|
+
end
|
26
|
+
|
27
|
+
# Called after every test method runs. Can be used to tear
|
28
|
+
# down fixture information.
|
29
|
+
|
30
|
+
def teardown
|
31
|
+
@ca_client.delete_object @object
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_01_attributes
|
35
|
+
result = @client.get_attributes(@object)
|
36
|
+
|
37
|
+
assert_equal @attributes.size, result.size
|
38
|
+
@attributes.each_with_index { |(k, v), i|
|
39
|
+
check_attribute result, i, v[0], v[1], k.to_s, v[2]
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_02_attribute
|
44
|
+
@attributes.each { |k, v|
|
45
|
+
result = @client.get_attribute @object, k.to_s
|
46
|
+
check_attribute [result], 0, v[0], v[1]
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def check_attribute(result, nr, display_value, element_id, element_code = nil, datatype = nil)
|
51
|
+
r = result
|
52
|
+
(nr.is_a?(Array) ? nr : [nr]).each { |i| r = r[i] }
|
53
|
+
assert_equal display_value, r['display_value']
|
54
|
+
assert_equal element_code, r['element_code']
|
55
|
+
assert_equal element_id, r['element_id']
|
56
|
+
assert_equal datatype, r['datatype']
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../test_helper'
|
3
|
+
|
4
|
+
class TestCaSearch < Test::Unit::TestCase
|
5
|
+
|
6
|
+
# Called before every test method runs. Can be used
|
7
|
+
# to set up fixture information.
|
8
|
+
def setup
|
9
|
+
@ca = ::Libis::Tools::Webservices::CollectiveAccess.new
|
10
|
+
@ca.authenticate
|
11
|
+
@object_label = 'TEST.0001.0001'
|
12
|
+
@object_id = @ca.add_object @object_label
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
# Called after every test method runs. Can be used to tear
|
17
|
+
# down fixture information.
|
18
|
+
def teardown
|
19
|
+
@ca.delete_object @object_id
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_01_search
|
23
|
+
result = @ca.search.query(@object_label)
|
24
|
+
#noinspection RubyStringKeysInHashInspection
|
25
|
+
expected = {
|
26
|
+
@object_id => {
|
27
|
+
'display_label' => nil,
|
28
|
+
'idno' => @object_label,
|
29
|
+
'object_id' => @object_id
|
30
|
+
}
|
31
|
+
}
|
32
|
+
assert_equal expected, result
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libis-tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kris Dekeyser
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: equivalent-xml
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: backports
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.6'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: savon
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: nokogiri
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.6'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.6'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: gyoku
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.2'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: nori
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.4'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.4'
|
153
|
+
description: Some tool classes for other LIBIS gems.
|
154
|
+
email:
|
155
|
+
- kris.dekeyser@libis.be
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".coveralls.yml"
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".travis.yml"
|
164
|
+
- Gemfile
|
165
|
+
- LICENSE.txt
|
166
|
+
- README.md
|
167
|
+
- Rakefile
|
168
|
+
- lib/libis-tools.rb
|
169
|
+
- lib/libis/tools.rb
|
170
|
+
- lib/libis/tools/assert.rb
|
171
|
+
- lib/libis/tools/checksum.rb
|
172
|
+
- lib/libis/tools/command.rb
|
173
|
+
- lib/libis/tools/config.rb
|
174
|
+
- lib/libis/tools/dc_record.rb
|
175
|
+
- lib/libis/tools/extend/empty.rb
|
176
|
+
- lib/libis/tools/extend/hash.rb
|
177
|
+
- lib/libis/tools/extend/ostruct.rb
|
178
|
+
- lib/libis/tools/extend/string.rb
|
179
|
+
- lib/libis/tools/extend/struct.rb
|
180
|
+
- lib/libis/tools/logger.rb
|
181
|
+
- lib/libis/tools/mets_file.rb
|
182
|
+
- lib/libis/tools/parameter.rb
|
183
|
+
- lib/libis/tools/sharepoint_mapping.rb
|
184
|
+
- lib/libis/tools/sharepoint_record.rb
|
185
|
+
- lib/libis/tools/version.rb
|
186
|
+
- lib/libis/tools/xml_document.rb
|
187
|
+
- libis-tools.gemspec
|
188
|
+
- spec/assert_spec.rb
|
189
|
+
- spec/checksum_spec.rb
|
190
|
+
- spec/command_spec.rb
|
191
|
+
- spec/config_spec.rb
|
192
|
+
- spec/data/test.data
|
193
|
+
- spec/data/test.xml
|
194
|
+
- spec/data/test.yml
|
195
|
+
- spec/logger_spec.rb
|
196
|
+
- spec/parameter_container_spec.rb
|
197
|
+
- spec/parameter_spec.rb
|
198
|
+
- spec/spec_helper.rb
|
199
|
+
- spec/test.xsd
|
200
|
+
- spec/xmldocument_spec.rb
|
201
|
+
- test/test_helper.rb
|
202
|
+
- test/webservices/test_ca_item_info.rb
|
203
|
+
- test/webservices/test_ca_search.rb
|
204
|
+
homepage: https://github.com/Kris-LIBIS/LIBIS_Tools
|
205
|
+
licenses:
|
206
|
+
- MIT
|
207
|
+
metadata: {}
|
208
|
+
post_install_message:
|
209
|
+
rdoc_options: []
|
210
|
+
require_paths:
|
211
|
+
- lib
|
212
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
217
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
requirements: []
|
223
|
+
rubyforge_project:
|
224
|
+
rubygems_version: 2.4.6
|
225
|
+
signing_key:
|
226
|
+
specification_version: 4
|
227
|
+
summary: LIBIS toolbox.
|
228
|
+
test_files:
|
229
|
+
- spec/assert_spec.rb
|
230
|
+
- spec/checksum_spec.rb
|
231
|
+
- spec/command_spec.rb
|
232
|
+
- spec/config_spec.rb
|
233
|
+
- spec/data/test.data
|
234
|
+
- spec/data/test.xml
|
235
|
+
- spec/data/test.yml
|
236
|
+
- spec/logger_spec.rb
|
237
|
+
- spec/parameter_container_spec.rb
|
238
|
+
- spec/parameter_spec.rb
|
239
|
+
- spec/spec_helper.rb
|
240
|
+
- spec/test.xsd
|
241
|
+
- spec/xmldocument_spec.rb
|
242
|
+
- test/test_helper.rb
|
243
|
+
- test/webservices/test_ca_item_info.rb
|
244
|
+
- test/webservices/test_ca_search.rb
|