dot_net_services 0.0.1 → 0.0.3
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.
- data/README +2 -2
- data/lib/dot_net_services/authentication.rb +0 -0
- data/lib/dot_net_services/error.rb +0 -0
- data/lib/dot_net_services/message_buffer.rb +18 -4
- data/lib/dot_net_services/session.rb +30 -4
- data/lib/dot_net_services.rb +3 -1
- data/lib/net/http/create_mb.rb +0 -0
- data/lib/net/http/retrieve.rb +0 -0
- data/lib/net/http/subscribe.rb +0 -0
- data/lib/net/http/unsubscribe.rb +0 -0
- data/spec/integration/TestService/Service/AnonymousResourceService.cs +0 -0
- data/spec/integration/TestService/Service/App.config +0 -0
- data/spec/integration/TestService/Service/PlainTextService.cs +0 -0
- data/spec/integration/TestService/Service/Program.cs +0 -0
- data/spec/integration/TestService/Service/Properties/AssemblyInfo.cs +0 -0
- data/spec/integration/TestService/Service/ResourceContract.cs +0 -0
- data/spec/integration/TestService/Service/ResourceService.cs +0 -0
- data/spec/integration/TestService/Service/Service.csproj +0 -0
- data/spec/integration/TestService/TestService.sln +0 -0
- data/spec/integration/end_to_end_spec.rb +0 -0
- data/spec/integration/vmb_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/unit/dot_net_services/authentication_spec.rb +0 -0
- data/spec/unit/dot_net_services/message_buffer_spec.rb +0 -0
- data/spec/unit/dot_net_services/session_spec.rb +0 -0
- metadata +3 -3
data/README
CHANGED
@@ -20,7 +20,7 @@ The library can be installed as a 'dot_net_services' gem, from RubyForge gem rep
|
|
20
20
|
|
21
21
|
or downloaded as an archive from RubyForge [http://rubyforge.org/frs/?group_id=7155].
|
22
22
|
|
23
|
-
<i>NOTE: Version number 0.
|
23
|
+
<i>NOTE: Version number 0.3.0 tells you that the API will have backwards-incompatible changes in future, so
|
24
24
|
Vendor Everything! [http://errtheblog.com/posts/50-vendor-everything]</i>
|
25
25
|
|
26
26
|
== Documentation
|
@@ -49,4 +49,4 @@ BSD license. See [LICENSE].
|
|
49
49
|
|
50
50
|
== Copyright
|
51
51
|
|
52
|
-
(c) ThoughtWorks, Inc 2008
|
52
|
+
(c) ThoughtWorks, Inc 2008
|
File without changes
|
File without changes
|
@@ -179,8 +179,8 @@ module DotNetServices
|
|
179
179
|
# .NET Services gets around this problem by making the client connection hang for some time, either until there
|
180
180
|
# is a message, or a certain number of seconds has passed, and there is still no message. That number of seconds is
|
181
181
|
# what the +timeout+ parameter specifies. Microsoft suggested that 10-20 seconds is reasonable for
|
182
|
-
# production purposes.
|
183
|
-
def poll(timeout=
|
182
|
+
# production purposes. Default value is 15 seconds.
|
183
|
+
def poll(timeout=15)
|
184
184
|
response = @session.retrieve(:encoding => 'asreply', :timeout => timeout)
|
185
185
|
case response
|
186
186
|
when Net::HTTPNoContent
|
@@ -239,7 +239,14 @@ module DotNetServices
|
|
239
239
|
#
|
240
240
|
# HTTP messages sent to the +endpoint+ will be routed to this message buffer
|
241
241
|
def subscribe(target_path)
|
242
|
-
|
242
|
+
# Changes for .Net Services March 2009 CTP release (M5)
|
243
|
+
tmpurl = @session.authenticator.username + "." + DotNetServices.root_url + "/" + target_path
|
244
|
+
|
245
|
+
# Replace unwanted slashes
|
246
|
+
tmpurl = tmpurl.gsub("\/\/\/", "\/")
|
247
|
+
tmpurl = tmpurl.gsub("\/\/", "\/")
|
248
|
+
subscription_endpoint_url = "http://" + tmpurl
|
249
|
+
|
243
250
|
subscribe_response = @session.subscribe(:target => subscription_endpoint_url)
|
244
251
|
case subscribe_response
|
245
252
|
when Net::HTTPSuccess
|
@@ -257,7 +264,14 @@ module DotNetServices
|
|
257
264
|
|
258
265
|
# Unsubscribe from an endpoint.
|
259
266
|
def unsubscribe(target_path)
|
260
|
-
|
267
|
+
# Changes for .Net Services March 2009 CTP release (M5)
|
268
|
+
tmpurl = @session.authenticator.username + "." + DotNetServices.root_url + "/" + target_path
|
269
|
+
|
270
|
+
# Replace unwanted slashes
|
271
|
+
tmpurl = tmpurl.gsub("\/\/\/", "\/")
|
272
|
+
tmpurl = tmpurl.gsub("\/\/", "\/")
|
273
|
+
subscription_endpoint_url = "http://" + tmpurl
|
274
|
+
|
261
275
|
unsubscribe_response = @session.unsubscribe(:target => subscription_endpoint_url)
|
262
276
|
unless unsubscribe_response.is_a?(Net::HTTPSuccess)
|
263
277
|
raise "X-UNSUBSCRIBE to VMB management endpoint failed. Response was #{subscribe_response.class}"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'cgi'
|
3
3
|
require 'net/http'
|
4
|
+
require 'net/http/unsubscribe'
|
4
5
|
|
5
6
|
module DotNetServices
|
6
7
|
|
@@ -90,6 +91,20 @@ module DotNetServices
|
|
90
91
|
@authenticator = Authentication.setup(auth_data)
|
91
92
|
end
|
92
93
|
|
94
|
+
def initialize(endpoint, auth_data=nil)
|
95
|
+
# Changes for .Net Services March 2009 CTP release (M5)
|
96
|
+
username = String.new
|
97
|
+
if auth_data.nil?
|
98
|
+
elsif !auth_data.is_a? Hash
|
99
|
+
else
|
100
|
+
auth_data_copy = auth_data.dup
|
101
|
+
username = auth_data_copy.delete(:username)
|
102
|
+
end
|
103
|
+
|
104
|
+
@endpoint_uri = setup_endpoint(endpoint, username)
|
105
|
+
@authenticator = Authentication.setup(auth_data)
|
106
|
+
end
|
107
|
+
|
93
108
|
# See DotNetServices::Session.open.
|
94
109
|
def open
|
95
110
|
authenticate
|
@@ -246,18 +261,29 @@ module DotNetServices
|
|
246
261
|
end
|
247
262
|
|
248
263
|
def route_to_relay(request)
|
249
|
-
request['X-Process-At'] = 'http://schemas.microsoft.com/
|
264
|
+
request['X-Process-At'] = 'http://schemas.microsoft.com/netservices/2009/05/servicebus/connect/roles/relay'
|
250
265
|
end
|
251
266
|
|
252
|
-
def setup_endpoint(endpoint)
|
267
|
+
def setup_endpoint(endpoint, username)
|
253
268
|
if endpoint !~ /^http(s?):\/\//
|
254
269
|
endpoint = '/' + endpoint unless endpoint[0] == ?/
|
255
|
-
|
270
|
+
|
271
|
+
# Changes for .Net Services March 2009 CTP release (M5)
|
272
|
+
if !username.empty?
|
273
|
+
tmpurl = username + "." + DotNetServices.root_url + "/" + endpoint
|
274
|
+
|
275
|
+
# Replace unnecessary slashes
|
276
|
+
tmpurl = tmpurl.gsub("\/\/\/", "\/")
|
277
|
+
tmpurl = tmpurl.gsub("\/\/", "\/")
|
278
|
+
endpoint = "http://" + tmpurl
|
279
|
+
else
|
280
|
+
raise "username must be provided to form the service bus endpoint."
|
281
|
+
end
|
256
282
|
end
|
257
283
|
endpoint += '/' unless endpoint[-1] == ?/
|
284
|
+
|
258
285
|
URI.parse(endpoint)
|
259
286
|
end
|
260
|
-
|
261
287
|
def setup_query_string(url, query_options)
|
262
288
|
if url && !url.empty?
|
263
289
|
uri = @endpoint_uri + url.to_s
|
data/lib/dot_net_services.rb
CHANGED
@@ -103,7 +103,9 @@ module DotNetServices
|
|
103
103
|
|
104
104
|
# The root URL used for exposing services.
|
105
105
|
def root_url
|
106
|
-
|
106
|
+
# Modified as per changes in enpoint URL naming conventions in
|
107
|
+
# .Net Services March 09 CTP release (M5)
|
108
|
+
"#{relay_host}/"
|
107
109
|
end
|
108
110
|
|
109
111
|
# Host and port of the bus endpoint.
|
data/lib/net/http/create_mb.rb
CHANGED
File without changes
|
data/lib/net/http/retrieve.rb
CHANGED
File without changes
|
data/lib/net/http/subscribe.rb
CHANGED
File without changes
|
data/lib/net/http/unsubscribe.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dot_net_services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ThoughtWorks
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-07-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements: []
|
80
80
|
|
81
81
|
rubyforge_project: dotnetsrv-ruby
|
82
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.3.1
|
83
83
|
signing_key:
|
84
84
|
specification_version: 2
|
85
85
|
summary: .NET Services for Ruby
|