isbm_adaptor 1.0.rc8.6 → 1.0.rc8.7
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 +7 -0
- data/LICENSE +9 -9
- data/README.md +133 -59
- data/lib/isbm_adaptor/channel.rb +38 -37
- data/lib/isbm_adaptor/channel_management.rb +78 -78
- data/lib/isbm_adaptor/client.rb +93 -86
- data/lib/isbm_adaptor/consumer_publication.rb +71 -71
- data/lib/isbm_adaptor/consumer_request.rb +109 -109
- data/lib/isbm_adaptor/duration.rb +88 -88
- data/lib/isbm_adaptor/message.rb +23 -23
- data/lib/isbm_adaptor/provider_publication.rb +92 -92
- data/lib/isbm_adaptor/provider_request.rb +110 -110
- data/lib/isbm_adaptor/version.rb +4 -3
- data/lib/isbm_adaptor.rb +12 -12
- data/wsdls/ISBMConsumerRequestService.wsdl +348 -348
- data/wsdls/ISBMProviderRequestService.wsdl +375 -375
- metadata +29 -31
@@ -1,92 +1,92 @@
|
|
1
|
-
require 'isbm_adaptor/client'
|
2
|
-
require 'isbm_adaptor/duration'
|
3
|
-
|
4
|
-
module IsbmAdaptor
|
5
|
-
class ProviderPublication < IsbmAdaptor::Client
|
6
|
-
|
7
|
-
# Creates a new ISBM ProviderPublication client.
|
8
|
-
#
|
9
|
-
# @param endpoint [String] the SOAP endpoint URI
|
10
|
-
# @option options [Object] :logger (Rails.logger or $stdout) location where log should be output
|
11
|
-
# @option options [Boolean] :log (true) specify whether requests are logged
|
12
|
-
# @option options [Boolean] :pretty_print_xml (false) specify whether request and response XML are formatted
|
13
|
-
def initialize(endpoint, options = {})
|
14
|
-
super('ISBMProviderPublicationService.wsdl', endpoint, options)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Opens a publication session for a channel.
|
18
|
-
#
|
19
|
-
# @param uri [String] the channel URI
|
20
|
-
# @return [String] the session id
|
21
|
-
# @raise [ArgumentError] if uri is
|
22
|
-
def open_session(uri)
|
23
|
-
validate_presence_of uri, 'Channel URI'
|
24
|
-
|
25
|
-
response = @client.call(:open_publication_session, message: { 'ChannelURI' => uri })
|
26
|
-
|
27
|
-
response.to_hash[:open_publication_session_response][:session_id].to_s
|
28
|
-
end
|
29
|
-
|
30
|
-
# Posts a publication message.
|
31
|
-
#
|
32
|
-
# @param session_id [String] the session id
|
33
|
-
# @param content [String] a valid XML string as message contents
|
34
|
-
# @param topics [Array<String>, String] a collection of topics or single topic
|
35
|
-
# @param expiry [Duration] when the message should expire
|
36
|
-
# @return [String] the message id
|
37
|
-
# @raise [ArgumentError] if session_id, content or topics are
|
38
|
-
# content is not valid XML
|
39
|
-
def post_publication(session_id, content, topics, expiry = nil)
|
40
|
-
validate_presence_of session_id, 'Session Id'
|
41
|
-
validate_presence_of content, 'Content'
|
42
|
-
validate_presence_of topics, 'Topics'
|
43
|
-
validate_xml content
|
44
|
-
|
45
|
-
topics = [topics].flatten
|
46
|
-
|
47
|
-
# Use Builder to generate XML body as we need to concatenate XML message content
|
48
|
-
xml = Builder::XmlMarkup.new
|
49
|
-
xml.isbm :SessionID, session_id
|
50
|
-
xml.isbm :MessageContent do
|
51
|
-
xml << content
|
52
|
-
end
|
53
|
-
topics.each do |topic|
|
54
|
-
xml.isbm :Topic, topic
|
55
|
-
end
|
56
|
-
duration = expiry.to_s
|
57
|
-
xml.isbm :Expiry, duration unless duration.nil?
|
58
|
-
|
59
|
-
response = @client.call(:post_publication, message: xml.target!)
|
60
|
-
|
61
|
-
response.to_hash[:post_publication_response][:message_id].to_s
|
62
|
-
end
|
63
|
-
|
64
|
-
# Expires a posted publication message.
|
65
|
-
#
|
66
|
-
# @param session_id [String] the session id used to post the publication
|
67
|
-
# @param message_id [String] the message id received after posting the publication
|
68
|
-
# @return [void]
|
69
|
-
# @raise [ArgumentError] if session_id or message_id are
|
70
|
-
def expire_publication(session_id, message_id)
|
71
|
-
validate_presence_of session_id, 'Session Id'
|
72
|
-
validate_presence_of message_id, 'Message Id'
|
73
|
-
|
74
|
-
@client.call(:expire_publication, message: { 'SessionID' => session_id, 'MessageID' => message_id })
|
75
|
-
|
76
|
-
return true
|
77
|
-
end
|
78
|
-
|
79
|
-
# Closes a publication session.
|
80
|
-
#
|
81
|
-
# @param session_id [String] the session id
|
82
|
-
# @return [void]
|
83
|
-
# @raise [ArgumentError] if session_id is
|
84
|
-
def close_session(session_id)
|
85
|
-
validate_presence_of session_id, 'Session Id'
|
86
|
-
|
87
|
-
@client.call(:close_publication_session, message: { 'SessionID' => session_id })
|
88
|
-
|
89
|
-
return true
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
1
|
+
require 'isbm_adaptor/client'
|
2
|
+
require 'isbm_adaptor/duration'
|
3
|
+
|
4
|
+
module IsbmAdaptor
|
5
|
+
class ProviderPublication < IsbmAdaptor::Client
|
6
|
+
|
7
|
+
# Creates a new ISBM ProviderPublication client.
|
8
|
+
#
|
9
|
+
# @param endpoint [String] the SOAP endpoint URI
|
10
|
+
# @option options [Object] :logger (Rails.logger or $stdout) location where log should be output
|
11
|
+
# @option options [Boolean] :log (true) specify whether requests are logged
|
12
|
+
# @option options [Boolean] :pretty_print_xml (false) specify whether request and response XML are formatted
|
13
|
+
def initialize(endpoint, options = {})
|
14
|
+
super('ISBMProviderPublicationService.wsdl', endpoint, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Opens a publication session for a channel.
|
18
|
+
#
|
19
|
+
# @param uri [String] the channel URI
|
20
|
+
# @return [String] the session id
|
21
|
+
# @raise [ArgumentError] if uri is blank
|
22
|
+
def open_session(uri)
|
23
|
+
validate_presence_of uri, 'Channel URI'
|
24
|
+
|
25
|
+
response = @client.call(:open_publication_session, message: { 'ChannelURI' => uri })
|
26
|
+
|
27
|
+
response.to_hash[:open_publication_session_response][:session_id].to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
# Posts a publication message.
|
31
|
+
#
|
32
|
+
# @param session_id [String] the session id
|
33
|
+
# @param content [String] a valid XML string as message contents
|
34
|
+
# @param topics [Array<String>, String] a collection of topics or single topic
|
35
|
+
# @param expiry [Duration] when the message should expire
|
36
|
+
# @return [String] the message id
|
37
|
+
# @raise [ArgumentError] if session_id, content or topics are blank, or
|
38
|
+
# content is not valid XML
|
39
|
+
def post_publication(session_id, content, topics, expiry = nil)
|
40
|
+
validate_presence_of session_id, 'Session Id'
|
41
|
+
validate_presence_of content, 'Content'
|
42
|
+
validate_presence_of topics, 'Topics'
|
43
|
+
validate_xml content
|
44
|
+
|
45
|
+
topics = [topics].flatten
|
46
|
+
|
47
|
+
# Use Builder to generate XML body as we need to concatenate XML message content
|
48
|
+
xml = Builder::XmlMarkup.new
|
49
|
+
xml.isbm :SessionID, session_id
|
50
|
+
xml.isbm :MessageContent do
|
51
|
+
xml << content
|
52
|
+
end
|
53
|
+
topics.each do |topic|
|
54
|
+
xml.isbm :Topic, topic
|
55
|
+
end
|
56
|
+
duration = expiry.to_s
|
57
|
+
xml.isbm :Expiry, duration unless duration.nil?
|
58
|
+
|
59
|
+
response = @client.call(:post_publication, message: xml.target!)
|
60
|
+
|
61
|
+
response.to_hash[:post_publication_response][:message_id].to_s
|
62
|
+
end
|
63
|
+
|
64
|
+
# Expires a posted publication message.
|
65
|
+
#
|
66
|
+
# @param session_id [String] the session id used to post the publication
|
67
|
+
# @param message_id [String] the message id received after posting the publication
|
68
|
+
# @return [void]
|
69
|
+
# @raise [ArgumentError] if session_id or message_id are blank
|
70
|
+
def expire_publication(session_id, message_id)
|
71
|
+
validate_presence_of session_id, 'Session Id'
|
72
|
+
validate_presence_of message_id, 'Message Id'
|
73
|
+
|
74
|
+
@client.call(:expire_publication, message: { 'SessionID' => session_id, 'MessageID' => message_id })
|
75
|
+
|
76
|
+
return true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Closes a publication session.
|
80
|
+
#
|
81
|
+
# @param session_id [String] the session id
|
82
|
+
# @return [void]
|
83
|
+
# @raise [ArgumentError] if session_id is blank
|
84
|
+
def close_session(session_id)
|
85
|
+
validate_presence_of session_id, 'Session Id'
|
86
|
+
|
87
|
+
@client.call(:close_publication_session, message: { 'SessionID' => session_id })
|
88
|
+
|
89
|
+
return true
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -1,110 +1,110 @@
|
|
1
|
-
require 'isbm_adaptor/client'
|
2
|
-
|
3
|
-
module IsbmAdaptor
|
4
|
-
class ProviderRequest < IsbmAdaptor::Client
|
5
|
-
|
6
|
-
# Creates a new ISBM ProviderRequest client.
|
7
|
-
#
|
8
|
-
# @param endpoint [String] the SOAP endpoint URI
|
9
|
-
# @option options [Object] :logger (Rails.logger or $stdout) location where log should be output
|
10
|
-
# @option options [Boolean] :log (true) specify whether requests are logged
|
11
|
-
# @option options [Boolean] :pretty_print_xml (false) specify whether request and response XML are formatted
|
12
|
-
def initialize(endpoint, options = {})
|
13
|
-
super('ISBMProviderRequestService.wsdl', endpoint, options)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Opens a provider request session for a channel for reading requests and
|
17
|
-
# posting responses.
|
18
|
-
#
|
19
|
-
# @param uri [String] the channel URI
|
20
|
-
# @param topics [Array<String>] an array of topics
|
21
|
-
# @param listener_uri [String] the URI for notification callbacks
|
22
|
-
# @return [String] the session id
|
23
|
-
# @raise [ArgumentError] if uri or topics are
|
24
|
-
def open_session(uri, topics, listener_uri = nil)
|
25
|
-
validate_presence_of uri, 'Channel URI'
|
26
|
-
validate_presence_of topics, 'Topics'
|
27
|
-
|
28
|
-
# Use Builder to generate XML body as we may have multiple Topic elements
|
29
|
-
xml = Builder::XmlMarkup.new
|
30
|
-
xml.isbm :ChannelURI, uri
|
31
|
-
topics.each do |topic|
|
32
|
-
xml.isbm :Topic, topic
|
33
|
-
end
|
34
|
-
xml.isbm :ListenerURI, listener_uri unless listener_uri.nil?
|
35
|
-
|
36
|
-
response = @client.call(:open_provider_request_session, message: xml.target!)
|
37
|
-
|
38
|
-
response.to_hash[:open_provider_request_session_response][:session_id].to_s
|
39
|
-
end
|
40
|
-
|
41
|
-
# Returns the first request message in the message queue for the session.
|
42
|
-
# Note: this service does not remove the message from the message queue.
|
43
|
-
#
|
44
|
-
# @param session_id [String] the session id
|
45
|
-
# @return [Message] the first message in the queue for the session.
|
46
|
-
# nil if no message.
|
47
|
-
# @raise [ArgumentError] if session_id is
|
48
|
-
def read_request(session_id)
|
49
|
-
validate_presence_of session_id, 'Session Id'
|
50
|
-
|
51
|
-
message = { 'SessionID' => session_id }
|
52
|
-
response = @client.call(:read_request, message: message)
|
53
|
-
|
54
|
-
extract_message(response)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Deletes the first request message, if any, in the message queue for the session.
|
58
|
-
#
|
59
|
-
# @param session_id [String] the session id
|
60
|
-
# @return [void]
|
61
|
-
# @raise [ArgumentError] if session_id is
|
62
|
-
def remove_request(session_id)
|
63
|
-
validate_presence_of session_id, 'Session Id'
|
64
|
-
|
65
|
-
@client.call(:remove_request, message: { 'SessionID' => session_id })
|
66
|
-
|
67
|
-
return true
|
68
|
-
end
|
69
|
-
|
70
|
-
# Posts a response message on a channel.
|
71
|
-
#
|
72
|
-
# @param session_id [String] the session id
|
73
|
-
# @param request_message_id [String] the id of the original request message
|
74
|
-
# @param content [String] a valid XML string as message contents
|
75
|
-
# @return [String] the response message id
|
76
|
-
# @raise [ArgumentError] if session_id, request_message_id or content are
|
77
|
-
#
|
78
|
-
def post_response(session_id, request_message_id, content)
|
79
|
-
validate_presence_of session_id, 'Session Id'
|
80
|
-
validate_presence_of request_message_id, 'Request Message Id'
|
81
|
-
validate_presence_of content, 'Content'
|
82
|
-
validate_xml content
|
83
|
-
|
84
|
-
# Use Builder to generate XML body as we need to concatenate XML message content
|
85
|
-
xml = Builder::XmlMarkup.new
|
86
|
-
xml.isbm :SessionID, session_id
|
87
|
-
xml.isbm :RequestMessageID, request_message_id
|
88
|
-
xml.isbm :MessageContent do
|
89
|
-
xml << content
|
90
|
-
end
|
91
|
-
|
92
|
-
response = @client.call(:post_response, message: xml.target!)
|
93
|
-
|
94
|
-
response.to_hash[:post_response_response][:message_id].to_s
|
95
|
-
end
|
96
|
-
|
97
|
-
# Closes a provider request session.
|
98
|
-
#
|
99
|
-
# @param session_id [String] the session id
|
100
|
-
# @return [void]
|
101
|
-
# @raise [ArgumentError] if session_id is
|
102
|
-
def close_session(session_id)
|
103
|
-
validate_presence_of session_id, 'Session Id'
|
104
|
-
|
105
|
-
@client.call(:close_provider_request_session, message: { 'SessionID' => session_id })
|
106
|
-
|
107
|
-
return true
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
1
|
+
require 'isbm_adaptor/client'
|
2
|
+
|
3
|
+
module IsbmAdaptor
|
4
|
+
class ProviderRequest < IsbmAdaptor::Client
|
5
|
+
|
6
|
+
# Creates a new ISBM ProviderRequest client.
|
7
|
+
#
|
8
|
+
# @param endpoint [String] the SOAP endpoint URI
|
9
|
+
# @option options [Object] :logger (Rails.logger or $stdout) location where log should be output
|
10
|
+
# @option options [Boolean] :log (true) specify whether requests are logged
|
11
|
+
# @option options [Boolean] :pretty_print_xml (false) specify whether request and response XML are formatted
|
12
|
+
def initialize(endpoint, options = {})
|
13
|
+
super('ISBMProviderRequestService.wsdl', endpoint, options)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Opens a provider request session for a channel for reading requests and
|
17
|
+
# posting responses.
|
18
|
+
#
|
19
|
+
# @param uri [String] the channel URI
|
20
|
+
# @param topics [Array<String>] an array of topics
|
21
|
+
# @param listener_uri [String] the URI for notification callbacks
|
22
|
+
# @return [String] the session id
|
23
|
+
# @raise [ArgumentError] if uri or topics are blank
|
24
|
+
def open_session(uri, topics, listener_uri = nil)
|
25
|
+
validate_presence_of uri, 'Channel URI'
|
26
|
+
validate_presence_of topics, 'Topics'
|
27
|
+
|
28
|
+
# Use Builder to generate XML body as we may have multiple Topic elements
|
29
|
+
xml = Builder::XmlMarkup.new
|
30
|
+
xml.isbm :ChannelURI, uri
|
31
|
+
topics.each do |topic|
|
32
|
+
xml.isbm :Topic, topic
|
33
|
+
end
|
34
|
+
xml.isbm :ListenerURI, listener_uri unless listener_uri.nil?
|
35
|
+
|
36
|
+
response = @client.call(:open_provider_request_session, message: xml.target!)
|
37
|
+
|
38
|
+
response.to_hash[:open_provider_request_session_response][:session_id].to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns the first request message in the message queue for the session.
|
42
|
+
# Note: this service does not remove the message from the message queue.
|
43
|
+
#
|
44
|
+
# @param session_id [String] the session id
|
45
|
+
# @return [Message] the first message in the queue for the session.
|
46
|
+
# nil if no message.
|
47
|
+
# @raise [ArgumentError] if session_id is blank
|
48
|
+
def read_request(session_id)
|
49
|
+
validate_presence_of session_id, 'Session Id'
|
50
|
+
|
51
|
+
message = { 'SessionID' => session_id }
|
52
|
+
response = @client.call(:read_request, message: message)
|
53
|
+
|
54
|
+
extract_message(response)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Deletes the first request message, if any, in the message queue for the session.
|
58
|
+
#
|
59
|
+
# @param session_id [String] the session id
|
60
|
+
# @return [void]
|
61
|
+
# @raise [ArgumentError] if session_id is blank
|
62
|
+
def remove_request(session_id)
|
63
|
+
validate_presence_of session_id, 'Session Id'
|
64
|
+
|
65
|
+
@client.call(:remove_request, message: { 'SessionID' => session_id })
|
66
|
+
|
67
|
+
return true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Posts a response message on a channel.
|
71
|
+
#
|
72
|
+
# @param session_id [String] the session id
|
73
|
+
# @param request_message_id [String] the id of the original request message
|
74
|
+
# @param content [String] a valid XML string as message contents
|
75
|
+
# @return [String] the response message id
|
76
|
+
# @raise [ArgumentError] if session_id, request_message_id or content are
|
77
|
+
# blank, or content is not valid XML
|
78
|
+
def post_response(session_id, request_message_id, content)
|
79
|
+
validate_presence_of session_id, 'Session Id'
|
80
|
+
validate_presence_of request_message_id, 'Request Message Id'
|
81
|
+
validate_presence_of content, 'Content'
|
82
|
+
validate_xml content
|
83
|
+
|
84
|
+
# Use Builder to generate XML body as we need to concatenate XML message content
|
85
|
+
xml = Builder::XmlMarkup.new
|
86
|
+
xml.isbm :SessionID, session_id
|
87
|
+
xml.isbm :RequestMessageID, request_message_id
|
88
|
+
xml.isbm :MessageContent do
|
89
|
+
xml << content
|
90
|
+
end
|
91
|
+
|
92
|
+
response = @client.call(:post_response, message: xml.target!)
|
93
|
+
|
94
|
+
response.to_hash[:post_response_response][:message_id].to_s
|
95
|
+
end
|
96
|
+
|
97
|
+
# Closes a provider request session.
|
98
|
+
#
|
99
|
+
# @param session_id [String] the session id
|
100
|
+
# @return [void]
|
101
|
+
# @raise [ArgumentError] if session_id is blank
|
102
|
+
def close_session(session_id)
|
103
|
+
validate_presence_of session_id, 'Session Id'
|
104
|
+
|
105
|
+
@client.call(:close_provider_request_session, message: { 'SessionID' => session_id })
|
106
|
+
|
107
|
+
return true
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/lib/isbm_adaptor/version.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
module IsbmAdaptor
|
2
|
-
|
3
|
-
|
1
|
+
module IsbmAdaptor
|
2
|
+
# Version should match the ISBM spec version, with a patch level
|
3
|
+
VERSION = '1.0.rc8.7'
|
4
|
+
end
|
data/lib/isbm_adaptor.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'active_support/core_ext/object/blank'
|
2
|
-
require 'isbm_adaptor/version'
|
3
|
-
require 'savon'
|
4
|
-
|
5
|
-
module IsbmAdaptor
|
6
|
-
autoload :ChannelManagement, 'isbm_adaptor/channel_management'
|
7
|
-
autoload :ProviderPublication, 'isbm_adaptor/provider_publication'
|
8
|
-
autoload :ConsumerPublication, 'isbm_adaptor/consumer_publication'
|
9
|
-
autoload :ProviderRequest, 'isbm_adaptor/provider_request'
|
10
|
-
autoload :ConsumerRequest, 'isbm_adaptor/consumer_request'
|
11
|
-
autoload :Duration, 'isbm_adaptor/duration'
|
12
|
-
end
|
1
|
+
require 'active_support/core_ext/object/blank'
|
2
|
+
require 'isbm_adaptor/version'
|
3
|
+
require 'savon'
|
4
|
+
|
5
|
+
module IsbmAdaptor
|
6
|
+
autoload :ChannelManagement, 'isbm_adaptor/channel_management'
|
7
|
+
autoload :ProviderPublication, 'isbm_adaptor/provider_publication'
|
8
|
+
autoload :ConsumerPublication, 'isbm_adaptor/consumer_publication'
|
9
|
+
autoload :ProviderRequest, 'isbm_adaptor/provider_request'
|
10
|
+
autoload :ConsumerRequest, 'isbm_adaptor/consumer_request'
|
11
|
+
autoload :Duration, 'isbm_adaptor/duration'
|
12
|
+
end
|