marilyn-rpc 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/README.md +39 -4
  2. data/examples/async/client.rb +0 -5
  3. data/examples/authentication/client.rb +18 -0
  4. data/examples/authentication/server.rb +30 -0
  5. data/lib/marilyn-rpc.rb +1 -1
  6. data/lib/marilyn-rpc/client.rb +21 -3
  7. data/lib/marilyn-rpc/error.rb +13 -0
  8. data/lib/marilyn-rpc/mails.rb +3 -3
  9. data/lib/marilyn-rpc/server.rb +6 -11
  10. data/lib/marilyn-rpc/service.rb +86 -11
  11. data/lib/marilyn-rpc/service_cache.rb +44 -23
  12. data/lib/marilyn-rpc/version.rb +1 -1
  13. data/spec/mails_spec.rb +2 -1
  14. data/spec/server_spec.rb +1 -1
  15. data/spec/service_cache_spec.rb +140 -0
  16. data/spec/service_spec.rb +56 -5
  17. data/spec/spec_helper.rb +5 -0
  18. metadata +10 -34
  19. data/doc/MarilynRPC.html +0 -108
  20. data/doc/MarilynRPC/CallRequestMail.html +0 -578
  21. data/doc/MarilynRPC/CallResponseMail.html +0 -418
  22. data/doc/MarilynRPC/Envelope.html +0 -705
  23. data/doc/MarilynRPC/ExceptionMail.html +0 -338
  24. data/doc/MarilynRPC/Gentleman.html +0 -658
  25. data/doc/MarilynRPC/MailFactory.html +0 -284
  26. data/doc/MarilynRPC/MailHelper.html +0 -489
  27. data/doc/MarilynRPC/NativeClient.html +0 -579
  28. data/doc/MarilynRPC/NativeClientProxy.html +0 -303
  29. data/doc/MarilynRPC/Server.html +0 -406
  30. data/doc/MarilynRPC/Service.html +0 -599
  31. data/doc/MarilynRPC/ServiceCache.html +0 -481
  32. data/doc/_index.html +0 -219
  33. data/doc/class_list.html +0 -36
  34. data/doc/css/common.css +0 -1
  35. data/doc/css/full_list.css +0 -53
  36. data/doc/css/style.css +0 -318
  37. data/doc/file.README.html +0 -154
  38. data/doc/file_list.html +0 -38
  39. data/doc/frames.html +0 -13
  40. data/doc/index.html +0 -154
  41. data/doc/js/app.js +0 -203
  42. data/doc/js/full_list.js +0 -149
  43. data/doc/js/jquery.js +0 -16
  44. data/doc/method_list.html +0 -467
  45. data/doc/top-level-namespace.html +0 -88
  46. data/spec/service_cache.rb +0 -45
@@ -1,88 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>Top Level Namespace</title>
7
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
-
10
- <script type="text/javascript" charset="utf-8">
11
- relpath = '';
12
- if (relpath != '') relpath += '/';
13
- </script>
14
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
-
17
- </head>
18
- <body>
19
- <script type="text/javascript" charset="utf-8">
20
- if (window.top.frames.main) document.body.className = 'frames';
21
- </script>
22
-
23
- <div id="header">
24
- <div id="menu">
25
-
26
- <a href="_index.html">Index</a> &raquo;
27
-
28
-
29
- <span class="title">Top Level Namespace</span>
30
-
31
-
32
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
- </div>
34
-
35
- <div id="search">
36
- <a id="class_list_link" href="#">Class List</a>
37
- <a id="method_list_link" href="#">Method List</a>
38
- <a id ="file_list_link" href="#">File List</a>
39
- </div>
40
-
41
- <div class="clear"></div>
42
- </div>
43
-
44
- <iframe id="search_frame"></iframe>
45
-
46
- <div id="content"><h1>Top Level Namespace
47
-
48
-
49
-
50
- </h1>
51
-
52
- <dl class="box">
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
- </dl>
62
- <div class="clear"></div>
63
-
64
- <h2>Defined Under Namespace</h2>
65
- <p class="children">
66
-
67
-
68
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="MarilynRPC.html" title="MarilynRPC (module)">MarilynRPC</a></span>
69
-
70
-
71
-
72
-
73
- </p>
74
-
75
-
76
-
77
-
78
-
79
- </div>
80
-
81
- <div id="footer">
82
- Generated on Wed Jun 8 18:26:47 2011 by
83
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
84
- 0.6.8 (ruby-1.8.7).
85
- </div>
86
-
87
- </body>
88
- </html>
@@ -1,45 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe MarilynRPC::ServiceCache do
4
- before(:each) do
5
- class DeferObjectMock
6
- attr_accessor :callback
7
-
8
- def callback(&block)
9
- @callback = block
10
- end
11
-
12
- def call(*args)
13
- @callback.call(*args)
14
- end
15
- end
16
-
17
- class TestService < MarilynRPC::Service
18
- register "/test"
19
-
20
- def sync_method(a, b)
21
- a + b
22
- end
23
-
24
- def async_method(a, b)
25
- calc = DeferObjectMock.new
26
- MarilynRPC::Gentleman.new(calc) { |result| result }
27
- end
28
- end
29
- @cache = MarilynRPC::ServiceCache.new
30
- end
31
-
32
- it "should be possible to call a sync method" do
33
- mail = MarilynRPC::CallRequestMail.new(1, "/test", :sync_method, [1, 2])
34
- answer = @cache.call(mail)
35
- answer.should be_a(MarilynRPC::CallResponseMail)
36
- answer.result.should == 3
37
- end
38
-
39
- it "should be possible to call an async method" do
40
- mail = MarilynRPC::CallRequestMail.new(1, "/test", :async_method, [1, 2])
41
- answer = @cache.call(mail)
42
- answer.should be_a(MarilynRPC::Gentleman)
43
- answer.tag.should == 1
44
- end
45
- end