libis-services 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/lib/libis/services/aleph/search.rb +157 -0
- data/lib/libis/services/alma/web_service.rb +36 -0
- data/lib/libis/services/collective_access/cataloguing.rb +48 -0
- data/lib/libis/services/collective_access/connector.rb +151 -0
- data/lib/libis/services/collective_access/item_info.rb +36 -0
- data/lib/libis/services/collective_access/search.rb +26 -0
- data/lib/libis/services/collective_access/service.rb +80 -0
- data/lib/libis/services/collective_access.rb +1 -0
- data/lib/libis/services/digitool/digital_entity_manager.rb +223 -0
- data/lib/libis/services/digitool/digitool_connector.rb +46 -0
- data/lib/libis/services/digitool/meta_data_manager.rb +193 -0
- data/lib/libis/services/extend/http_fetch.rb +63 -0
- data/lib/libis/services/generic_search.rb +38 -0
- data/lib/libis/services/http_error.rb +21 -0
- data/lib/libis/services/oracle_client.rb +47 -0
- data/lib/libis/services/primo/limo.rb +33 -0
- data/lib/libis/services/primo/search.rb +46 -0
- data/lib/libis/services/primo.rb +2 -0
- data/lib/libis/services/rest_client.rb +66 -0
- data/lib/libis/services/rosetta/client.rb +108 -0
- data/lib/libis/services/rosetta/collection_handler.rb +45 -0
- data/lib/libis/services/rosetta/collection_info.rb +44 -0
- data/lib/libis/services/rosetta/deposit_activity.rb +48 -0
- data/lib/libis/services/rosetta/deposit_handler.rb +187 -0
- data/lib/libis/services/rosetta/ie.rb +19 -0
- data/lib/libis/services/rosetta/ie_handler.rb +29 -0
- data/lib/libis/services/rosetta/oai_pmh.rb +48 -0
- data/lib/libis/services/rosetta/oai_set.rb +21 -0
- data/lib/libis/services/rosetta/pds_handler.rb +60 -0
- data/lib/libis/services/rosetta/producer.rb +71 -0
- data/lib/libis/services/rosetta/producer_handler.rb +125 -0
- data/lib/libis/services/rosetta/service.rb +403 -0
- data/lib/libis/services/rosetta/sip.rb +26 -0
- data/lib/libis/services/rosetta/sip_handler.rb +31 -0
- data/lib/libis/services/rosetta/user.rb +70 -0
- data/lib/libis/services/rosetta/user_manager.rb +28 -0
- data/lib/libis/services/rosetta.rb +2 -0
- data/lib/libis/services/scope/search.rb +46 -0
- data/lib/libis/services/search_factory.rb +40 -0
- data/lib/libis/services/service_error.rb +16 -0
- data/lib/libis/services/sharepoint/connector.rb +236 -0
- data/lib/libis/services/sharepoint/search.rb +19 -0
- data/lib/libis/services/soap_client.rb +57 -0
- data/lib/libis/services/soap_error.rb +22 -0
- data/lib/libis/services/version.rb +5 -0
- data/lib/libis/services.rb +22 -0
- data/lib/libis-services.rb +1 -0
- data/libis-services.gemspec +40 -0
- data/spec/alma_service_spec.rb +104 -0
- data/spec/ie_data.rb +726 -0
- data/spec/primo_limo_spec.rb +363 -0
- data/spec/primo_search_spec.rb +39 -0
- data/spec/rosetta_collection_spec.rb +206 -0
- data/spec/rosetta_deposit_spec.rb +82 -0
- data/spec/rosetta_ie_spec.rb +54 -0
- data/spec/rosetta_oai_spec.rb +52 -0
- data/spec/rosetta_pds_spec.rb +79 -0
- data/spec/rosetta_producer_spec.rb +270 -0
- data/spec/rosetta_sip_spec.rb +39 -0
- data/spec/spec_helper.rb +28 -0
- metadata +317 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'libis/tools/extend/hash'
|
4
|
+
require_relative 'client'
|
5
|
+
require_relative 'sip'
|
6
|
+
require_relative 'ie'
|
7
|
+
|
8
|
+
module Libis
|
9
|
+
module Services
|
10
|
+
module Rosetta
|
11
|
+
|
12
|
+
class SipHandler < Libis::Services::Rosetta::Client
|
13
|
+
|
14
|
+
def initialize(base_url = 'http://depot.lias.be', options = {})
|
15
|
+
super 'repository', 'SipWebServices', {url: base_url}.merge(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_info(sip_id)
|
19
|
+
request_object :get_sip_status_info, Rosetta::Sip, arg0: sip_id
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_ies(sip_id)
|
23
|
+
request_array(:get_sip_i_es, arg0: sip_id).map {|ie| Rosetta::Ie.new(pid: ie)}
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'virtus'
|
2
|
+
|
3
|
+
module Libis
|
4
|
+
module Services
|
5
|
+
module Rosetta
|
6
|
+
class User
|
7
|
+
# noinspection RubyResolve
|
8
|
+
include Virtus.model nullify_blank: true
|
9
|
+
|
10
|
+
RECORD_TYPE = %w'USER CONTACT ORGANIZATION STAFF PUBLIC'
|
11
|
+
USER_STATUS = %w'ACTIVE INACTIVE DELETED'
|
12
|
+
USER_ROLES_STATUS = %w'NEW ACTIVE INACTIVE PENDING DELETED'
|
13
|
+
USER_TYPE = %w'CASUAL INTERNAL EXTERNAL INTEXTAUTH'
|
14
|
+
|
15
|
+
attribute :first_name, String
|
16
|
+
attribute :last_name, String
|
17
|
+
attribute :user_name, String
|
18
|
+
attribute :user_group, String
|
19
|
+
attribute :expiry_date, String
|
20
|
+
attribute :job_title, String
|
21
|
+
attribute :default_language, String
|
22
|
+
attribute :street, String
|
23
|
+
attribute :suburb, String
|
24
|
+
attribute :city, String
|
25
|
+
attribute :country, String
|
26
|
+
attribute :address_1, String
|
27
|
+
attribute :address_2, String
|
28
|
+
attribute :address_3, String
|
29
|
+
attribute :address_4, String
|
30
|
+
attribute :address_5, String
|
31
|
+
attribute :zip, Integer
|
32
|
+
attribute :email_address, String
|
33
|
+
attribute :web_site_url, String
|
34
|
+
attribute :telephone_1, String
|
35
|
+
attribute :telephone_2, String
|
36
|
+
attribute :fax, String
|
37
|
+
|
38
|
+
attribute :password, String
|
39
|
+
attribute :password_verify, String
|
40
|
+
|
41
|
+
def to_hash
|
42
|
+
super.cleanup
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_xml
|
46
|
+
Libis::Tools::XmlDocument.build do |xml|
|
47
|
+
# noinspection RubyResolve
|
48
|
+
xml.user_info {
|
49
|
+
xml.parent.default_namespace = 'http://www.exlibrisgroup.com/xsd/dps/backoffice/service'
|
50
|
+
self.attributes.each do |name, value|
|
51
|
+
xml.send(name, xmlns: '') { xml.text(value) } if value
|
52
|
+
end
|
53
|
+
}
|
54
|
+
end.to_xml
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.from_xml(xml)
|
58
|
+
xml_doc = Libis::Tools::XmlDocument.parse(xml)
|
59
|
+
hash = xml_doc.to_hash(
|
60
|
+
strip_namespaces: true,
|
61
|
+
delete_namespace_attributes: true,
|
62
|
+
empty_tag_value: nil,
|
63
|
+
convert_tags_to: lambda { |tag| tag.to_sym }
|
64
|
+
)
|
65
|
+
self.new(hash[:producer_info])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'virtus'
|
3
|
+
|
4
|
+
require 'libis/tools/extend/hash'
|
5
|
+
require_relative 'client'
|
6
|
+
|
7
|
+
module Libis
|
8
|
+
module Services
|
9
|
+
module Rosetta
|
10
|
+
|
11
|
+
class UserManager < Libis::Services::Rosetta::Client
|
12
|
+
|
13
|
+
def initialize(base_url = 'http://depot.lias.be', options = {})
|
14
|
+
super 'infra', 'UserManagerWS', {url: base_url}.merge(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def user(user_id, user_info)
|
18
|
+
user_info = user_info.to_hash if user_info.is_a? User
|
19
|
+
do_request :update_user, arg0: user_info, arg1: user_id
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'libis/services/oracle_client'
|
4
|
+
require 'libis/tools/xml_document'
|
5
|
+
|
6
|
+
module Libis
|
7
|
+
module Services
|
8
|
+
module Scope
|
9
|
+
|
10
|
+
class Search
|
11
|
+
include ::Libis::Services::GenericSearch
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@doc = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def find(term, options = {})
|
18
|
+
super
|
19
|
+
OracleClient.new('SCOPE01', 'APLKN_ARCHV_LIAS', 'archvsc').
|
20
|
+
call('kul_packages.scope_xml_meta_file_ed', [term.upcase])
|
21
|
+
err_file = "/nas/vol03/oracle/scope01/#{term}_err.XML"
|
22
|
+
if File.exist? err_file
|
23
|
+
doc = XmlDocument.open(err_file)
|
24
|
+
msg = doc.xpath('/error/error_msg').first.content
|
25
|
+
msg_detail = doc.xpath('/error/error_').first.content
|
26
|
+
File.delete(err_file)
|
27
|
+
@doc = nil
|
28
|
+
raise RuntimeError, "Scope search failed: '#{msg}'. Details: '#{msg_detail}'"
|
29
|
+
else
|
30
|
+
@doc = XmlDocument.open("/nas/vol03/oracle/scope01/#{term}_md.XML").to_hash
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def each(_ = {})
|
35
|
+
yield @doc
|
36
|
+
end
|
37
|
+
|
38
|
+
def next_record(_ = {})
|
39
|
+
yield @doc
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative 'aleph/search'
|
4
|
+
require_relative 'primo/search'
|
5
|
+
require_relative 'sharepoint/search'
|
6
|
+
require_relative 'scope/search'
|
7
|
+
|
8
|
+
module Libis
|
9
|
+
module Services
|
10
|
+
|
11
|
+
class SearchFactory
|
12
|
+
def initialize(format, *args)
|
13
|
+
@search_class = self.class.const_get("Libis::Services::#{format}::Search")
|
14
|
+
@search_client = @search_class.new *args
|
15
|
+
|
16
|
+
rescue Exception => e
|
17
|
+
puts e.message
|
18
|
+
exit -1
|
19
|
+
end
|
20
|
+
|
21
|
+
def query(query, options = {})
|
22
|
+
@search_client.get(query, options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def find(term, options = {})
|
26
|
+
@search_client.find(term, options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def each(options = {}, &block)
|
30
|
+
@search_client.each(options, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def next_record(options = {}, &block)
|
34
|
+
@search_client.next_record(options, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,236 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'highline'
|
4
|
+
require 'libis/tools/logger'
|
5
|
+
|
6
|
+
require 'libis/services/soap_client'
|
7
|
+
|
8
|
+
module Libis
|
9
|
+
module Services
|
10
|
+
module Sharepoint
|
11
|
+
|
12
|
+
class Search
|
13
|
+
include ::Libis::Services::SoapClient
|
14
|
+
include ::Libis::Tools::Logger
|
15
|
+
include ::Libis::Services::GenericSearch
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
MY_QUERY_SYMBOLS = {
|
20
|
+
nil => 'Eq',
|
21
|
+
'==' => 'Eq',
|
22
|
+
'!=' => 'Neq',
|
23
|
+
'>' => 'Gt',
|
24
|
+
'>=' => 'Geq',
|
25
|
+
'<' => 'Lt',
|
26
|
+
'<=' => 'Leq',
|
27
|
+
'is null' => 'IsNull'
|
28
|
+
}
|
29
|
+
|
30
|
+
MAX_QUERY_RETRY = 10
|
31
|
+
|
32
|
+
public
|
33
|
+
|
34
|
+
def initialize(options = {})
|
35
|
+
options[:server_url] = (options[:url] || 'https://www.groupware.kuleuven.be/sites/lias') + (options[:url_ext] || '/_vti_bin')
|
36
|
+
options[:ssl] = true if options[:server_url] =~ /^https:/
|
37
|
+
# options[:soap_url] = options[:server_url].gsub(/^(https?):\/\/)/,"\\1#{CGI.escape(username)}:#{CGI.escape(password)}@") + '/Lists.asmx'
|
38
|
+
options[:wsse_auth] = [options[:username], options[:password]]
|
39
|
+
options[:soap_url] = options[:server_url] + '/Lists.asmx'
|
40
|
+
options[:wsdl_url] = options[:soap_url] + '?wsdl'
|
41
|
+
configure options[:wsdl_url], options
|
42
|
+
options
|
43
|
+
end
|
44
|
+
|
45
|
+
def query(term, options = {})
|
46
|
+
|
47
|
+
options[:term] = term
|
48
|
+
|
49
|
+
options[:limit] ||= 100
|
50
|
+
options[:value_type] ||= 'Text'
|
51
|
+
options[:query_operator] = MY_QUERY_SYMBOLS[options[:query_operator] || '==']
|
52
|
+
|
53
|
+
options[:query_operator] = 'BeginsWith' if term =~ /^[^*]+\*$/
|
54
|
+
options[:query_operator] = 'Contains' if term =~ /^\*[^*]+\*$/
|
55
|
+
|
56
|
+
restart_query options
|
57
|
+
|
58
|
+
options
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def each(options)
|
63
|
+
|
64
|
+
# we start with a new search
|
65
|
+
restart_query options
|
66
|
+
get_next_set options
|
67
|
+
|
68
|
+
while records_to_process? options
|
69
|
+
|
70
|
+
yield options[:result][:records][options[:current]]
|
71
|
+
|
72
|
+
options[:current] += 1
|
73
|
+
|
74
|
+
get_next_set(options) if require_next_set?(options)
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
restart_query(options)
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
protected
|
83
|
+
|
84
|
+
def restart_query(options)
|
85
|
+
options[:start_id] = 0
|
86
|
+
options[:result] = nil
|
87
|
+
options[:current] = 0
|
88
|
+
options[:set_count] = 0
|
89
|
+
options[:next_set] = nil
|
90
|
+
end
|
91
|
+
|
92
|
+
def records_to_process?(options)
|
93
|
+
options[:current] < options[:set_count]
|
94
|
+
end
|
95
|
+
|
96
|
+
def require_next_set?(options)
|
97
|
+
options[:current] >= options[:set_count] and options[:next_set]
|
98
|
+
end
|
99
|
+
|
100
|
+
def get_next_set(options)
|
101
|
+
|
102
|
+
options[:current] = 0
|
103
|
+
options[:set_count] = 0
|
104
|
+
|
105
|
+
retry_count = MAX_QUERY_RETRY
|
106
|
+
|
107
|
+
while retry_count > 0
|
108
|
+
|
109
|
+
warn "Retrying (#{retry_count}) ..." if retry_count < MAX_QUERY_RETRY
|
110
|
+
|
111
|
+
query = {
|
112
|
+
'Query' => {
|
113
|
+
'Where' => {
|
114
|
+
options[:query_operator] => {
|
115
|
+
'FieldRef' => '',
|
116
|
+
'Value' => options[:term],
|
117
|
+
:attributes! => {
|
118
|
+
'FieldRef' => {
|
119
|
+
'Name' => options[:index]
|
120
|
+
},
|
121
|
+
'Value' => {
|
122
|
+
'Type' => options[:value_type]
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
query_options = {
|
131
|
+
'QueryOptions' => {
|
132
|
+
'ViewAttributes' => '',
|
133
|
+
:attributes! => {
|
134
|
+
'ViewAttributes' => {
|
135
|
+
'Scope' => 'RecursiveAll'
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
now = Time.now
|
142
|
+
window_start = Time.new(now.year, now.month, now.day, 12, 15)
|
143
|
+
window_end = Time.new(now.year, now.month, now.day, 13, 15)
|
144
|
+
if options[:selection] and now > window_start and now < window_end
|
145
|
+
query_options['QueryOptions']['Folder'] = options[:server_url] + 'Gedeelde%20documenten/' + options[:selection] + '/.'
|
146
|
+
end
|
147
|
+
|
148
|
+
if options[:next_set]
|
149
|
+
query_options['QueryOptions']['Paging'] = ''
|
150
|
+
query_options['QueryOptions'][:attributes!]['Paging'] = {'ListItemCollectionPositionNext' => options[:next_set]}
|
151
|
+
end
|
152
|
+
|
153
|
+
result = request 'GetListItems', {
|
154
|
+
soap_options: {
|
155
|
+
endpoint: options[:soap_url]
|
156
|
+
},
|
157
|
+
wsse_auth: options[:wsse_auth],
|
158
|
+
listName: options[:base],
|
159
|
+
viewName: '',
|
160
|
+
query: query,
|
161
|
+
viewFields: {'ViewFields' => ''},
|
162
|
+
rowLimit: options[:limit].to_s,
|
163
|
+
query_options: query_options,
|
164
|
+
webID: ''
|
165
|
+
}, {}, options
|
166
|
+
|
167
|
+
if result[:error]
|
168
|
+
warn "SOAP error: '#{result[:error]}'"
|
169
|
+
raise RuntimeError, 'Too many SOAP errors, giving up.' unless retry_count > 0
|
170
|
+
elsif result[:exception]
|
171
|
+
warn "SOAP exception: '#{result[:exception].message}'"
|
172
|
+
raise result[:exception] unless retry_count > 0
|
173
|
+
else
|
174
|
+
options[:result] = result
|
175
|
+
options[:set_count] = result[:count]
|
176
|
+
options[:next_set] = result[:next_set]
|
177
|
+
retry_count = 0
|
178
|
+
retry_count = MAX_QUERY_RETRY + 1 if options[:set_count] == 0 and options[:next_set]
|
179
|
+
end
|
180
|
+
|
181
|
+
retry_count -= 1
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
def result_parser(result, options)
|
188
|
+
|
189
|
+
records = []
|
190
|
+
result = result[:get_list_items_response][:get_list_items_result]
|
191
|
+
|
192
|
+
data = result[:listitems][:data]
|
193
|
+
|
194
|
+
rows = data[:row]
|
195
|
+
rows = [rows] unless rows.is_a? Array
|
196
|
+
|
197
|
+
rows.each do |row|
|
198
|
+
if options[:selection].nil? or row[:ows_FileRef] =~ /^\d+;#sites\/lias\/Gedeelde documenten\/#{options[:selection]}(|\/.*)$/
|
199
|
+
records << clean_row(row, options)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
next_set = data[:@list_item_collection_position_next]
|
204
|
+
|
205
|
+
# the itemcount in the response is not interesting. We count only the records that match our selection criteria.
|
206
|
+
count = records.size
|
207
|
+
|
208
|
+
{next_set: next_set, records: records, count: count}
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
def clean_row(row, options)
|
213
|
+
|
214
|
+
options[:fields_found] ||= Set.new
|
215
|
+
row.keys.each { |k| options[:fields_found] << k }
|
216
|
+
|
217
|
+
fields_to_be_removed = [:ows_MetaInfo]
|
218
|
+
fields_to_be_removed = row.keys - options[:field_selection] if options[:field_selection]
|
219
|
+
|
220
|
+
record = SharepointRecord.new
|
221
|
+
|
222
|
+
row.each do |k, v|
|
223
|
+
key = k.to_s.gsub(/^@/, '').to_sym
|
224
|
+
next if fields_to_be_removed.include? key
|
225
|
+
record[key] = v.dot_net_clean
|
226
|
+
end
|
227
|
+
|
228
|
+
record
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'libis/services/generic_search'
|
4
|
+
|
5
|
+
module Libis
|
6
|
+
module Services
|
7
|
+
module Sharepoint
|
8
|
+
|
9
|
+
class Search
|
10
|
+
include ::Libis::Services::GenericSearch
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
puts 'TODO'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'savon'
|
4
|
+
|
5
|
+
require 'libis/tools/xml_document'
|
6
|
+
require_relative 'http_error'
|
7
|
+
require_relative 'soap_error'
|
8
|
+
|
9
|
+
module Libis
|
10
|
+
module Services
|
11
|
+
|
12
|
+
module SoapClient
|
13
|
+
attr_reader :client
|
14
|
+
|
15
|
+
def configure(wsdl, options = {})
|
16
|
+
opts = {
|
17
|
+
wsdl: wsdl,
|
18
|
+
raise_errors: false,
|
19
|
+
soap_version: 1,
|
20
|
+
filters: [:password],
|
21
|
+
pretty_print_xml: true,
|
22
|
+
}.merge options
|
23
|
+
|
24
|
+
@client = Savon.client(opts) { yield if block_given? }
|
25
|
+
end
|
26
|
+
|
27
|
+
def operations
|
28
|
+
@client.operations
|
29
|
+
end
|
30
|
+
|
31
|
+
def request(method, message = {}, call_options = {}, parse_options = {})
|
32
|
+
response = client.call(method, message: message) do |locals|
|
33
|
+
call_options.each do |key, value|
|
34
|
+
locals.send(key, value)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
return yield(response) if block_given?
|
39
|
+
parse_result(response, parse_options)
|
40
|
+
end
|
41
|
+
|
42
|
+
protected
|
43
|
+
|
44
|
+
def parse_result(response, options = {})
|
45
|
+
raise SoapError.new response.soap_fault.to_hash if response.soap_fault?
|
46
|
+
raise HttpError.new response.http_error.to_hash if response.http_error?
|
47
|
+
self.result_parser(response.body, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def result_parser(response, options = {})
|
51
|
+
response
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Libis
|
4
|
+
module Services
|
5
|
+
|
6
|
+
class SoapError < Exception
|
7
|
+
attr_accessor :code, :text, :detail, :name
|
8
|
+
|
9
|
+
def initialize(error)
|
10
|
+
@code = error[:fault][:faultcode] rescue nil
|
11
|
+
@text = error[:fault][:faultstring] rescue nil
|
12
|
+
@detail = error[:fault][:detail] rescue nil
|
13
|
+
@name = @detail.first.first rescue nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def message
|
17
|
+
"#{code}:#{name} #{text}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Libis
|
2
|
+
module Services
|
3
|
+
|
4
|
+
autoload :HttpError, 'libis/services/http_error'
|
5
|
+
autoload :SoapError, 'libis/services/soap_error'
|
6
|
+
autoload :ServiceError, 'libis/services/service_error'
|
7
|
+
|
8
|
+
autoload :SoapClient, 'libis/services/soap_client'
|
9
|
+
autoload :RestClient, 'libis/services/rest_client'
|
10
|
+
|
11
|
+
autoload :OracleClient, 'libis/services/oracle_client'
|
12
|
+
autoload :DigitoolConnector, 'libis/services/digitool_connector'
|
13
|
+
autoload :DigitalEntityManager, 'libis/services/digital_entity_manager'
|
14
|
+
autoload :MetaDataManager, 'libis/services/meta_data_manager'
|
15
|
+
|
16
|
+
autoload :SharepointConnector, 'libis/services/sharepoint_connector'
|
17
|
+
|
18
|
+
autoload :Rosetta, 'libis/services/rosetta'
|
19
|
+
autoload :Primo, 'libis/services/primo'
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'libis/services'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require 'libis/services/version'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'libis-services'
|
10
|
+
spec.version = Libis::Services::VERSION
|
11
|
+
spec.authors = ['Kris Dekeyser']
|
12
|
+
spec.email = ['kris.dekeyser@libis.be']
|
13
|
+
spec.summary = %q{LIBIS Services toolbox.}
|
14
|
+
spec.description = %q{Set of classes that simplify connection to different LIBIS services.}
|
15
|
+
spec.homepage = 'https://github.com/Kris-LIBIS/LIBIS_Services'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.platform = Gem::Platform::JAVA if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0")
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.3'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.9'
|
29
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
30
|
+
spec.add_development_dependency 'equivalent-xml', '~> 0.6'
|
31
|
+
|
32
|
+
spec.add_runtime_dependency 'libis-tools', '~> 0.9'
|
33
|
+
spec.add_runtime_dependency 'highline', '~> 1.7'
|
34
|
+
spec.add_runtime_dependency 'savon', '~> 2.11'
|
35
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.8'
|
36
|
+
spec.add_runtime_dependency 'oai', '~> 0.4'
|
37
|
+
spec.add_runtime_dependency 'virtus', '~> 1.0'
|
38
|
+
spec.add_runtime_dependency 'write_xlsx', '~> 0.83'
|
39
|
+
spec.add_runtime_dependency 'awesome_print', '~> 1.6'
|
40
|
+
end
|