rawjsonrpc 0.0.1 → 0.1.0

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.
Files changed (44) hide show
  1. data/README.rdoc +2 -4
  2. data/Rakefile +3 -3
  3. data/VERSION +1 -1
  4. data/doc/rdoc/README_rdoc.html +238 -0
  5. data/doc/rdoc/RawJsonRpc/ClientSock.html +244 -0
  6. data/doc/rdoc/RawJsonRpc/RawClientJsonRpc.html +387 -0
  7. data/doc/rdoc/RawJsonRpc/RawServerJsonRpc.html +310 -0
  8. data/doc/rdoc/RawJsonRpc/ServerSocket.html +290 -0
  9. data/doc/rdoc/RawJsonRpc/TCPServer.html +166 -0
  10. data/doc/rdoc/RawJsonRpc.html +174 -0
  11. data/doc/rdoc/RpcError.html +158 -0
  12. data/doc/rdoc/created.rid +6 -0
  13. data/doc/rdoc/images/brick.png +0 -0
  14. data/doc/rdoc/images/brick_link.png +0 -0
  15. data/doc/rdoc/images/bug.png +0 -0
  16. data/doc/rdoc/images/bullet_black.png +0 -0
  17. data/doc/rdoc/images/bullet_toggle_minus.png +0 -0
  18. data/doc/rdoc/images/bullet_toggle_plus.png +0 -0
  19. data/doc/rdoc/images/date.png +0 -0
  20. data/doc/rdoc/images/find.png +0 -0
  21. data/doc/rdoc/images/loadingAnimation.gif +0 -0
  22. data/doc/rdoc/images/macFFBgHack.png +0 -0
  23. data/doc/rdoc/images/package.png +0 -0
  24. data/doc/rdoc/images/page_green.png +0 -0
  25. data/doc/rdoc/images/page_white_text.png +0 -0
  26. data/doc/rdoc/images/page_white_width.png +0 -0
  27. data/doc/rdoc/images/plugin.png +0 -0
  28. data/doc/rdoc/images/ruby.png +0 -0
  29. data/doc/rdoc/images/tag_green.png +0 -0
  30. data/doc/rdoc/images/wrench.png +0 -0
  31. data/doc/rdoc/images/wrench_orange.png +0 -0
  32. data/doc/rdoc/images/zoom.png +0 -0
  33. data/doc/rdoc/index.html +92 -0
  34. data/doc/rdoc/js/darkfish.js +116 -0
  35. data/doc/rdoc/js/jquery.js +32 -0
  36. data/doc/rdoc/js/quicksearch.js +114 -0
  37. data/doc/rdoc/js/thickbox-compressed.js +10 -0
  38. data/doc/rdoc/lib/rawjsonrpc/client_rb.html +63 -0
  39. data/doc/rdoc/lib/rawjsonrpc/error_rb.html +59 -0
  40. data/doc/rdoc/lib/rawjsonrpc/server_rb.html +67 -0
  41. data/doc/rdoc/lib/rawjsonrpc_rb.html +61 -0
  42. data/doc/rdoc/rdoc.css +763 -0
  43. data/rawjsonrpc.gemspec +95 -0
  44. metadata +48 -8
data/README.rdoc CHANGED
@@ -25,8 +25,7 @@ Create a client to send rpc calls.
25
25
  #returns result in ret
26
26
  ret = client.request("func2", 1, 3.0, :test, "om") #calles func2 with 4 paras
27
27
  ret = client.func3([1, 2, 3, 4]) #calles func3 with a array
28
- client.notification("noti", 1, "t") #send notifaction no
29
- # #return value
28
+ client.notification("noti", 1, "t") #send notifaction no return value
30
29
  client.close()
31
30
 
32
31
  == Use server TCP simple
@@ -85,8 +84,7 @@ The boilerplattecode to create a new server.
85
84
  def serve
86
85
  #get data from client
87
86
  response = execute(jsonstring) #transfers the string and calls function
88
- #return response string or nil if its a
89
- # #notification
87
+ #return response string or nil if its a notification
90
88
  #send response
91
89
  end
92
90
 
data/Rakefile CHANGED
@@ -15,10 +15,10 @@ require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
17
  gem.name = "rawjsonrpc"
18
- gem.homepage = "http://github.com/schroder-/rawjsonrpc"
18
+ gem.homepage = "http://github.com/schroeder-/rawjsonrpc"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{A basic libary for json rpc that allow to create for your stream type. It includes a TCPIp Server and Client.}
21
- gem.description = %Q{A basic libary for json rpc that allow you to easly create one for your streamtype .It includes tcp json rpc on socket connections. Version for single clients server, one for multiple clients server based on gserver are served and a TCP client.}
21
+ gem.description = %Q{A basic libary for json rpc that allow you to easly create one for your streamtype. It includes tcp json rpc on socket connections. Version for single clients server, one for multiple clients server based on gserver are served and a TCP client.}
22
22
  gem.email = "midix01@googlemail.com"
23
23
  gem.authors = ["Alexander Schrode"]
24
24
  # dependencies defined in Gemfile
@@ -38,7 +38,7 @@ require 'rake/rdoctask'
38
38
  Rake::RDocTask.new do |rdoc|
39
39
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
40
 
41
- rdoc.rdoc_dir = 'rdoc'
41
+ rdoc.rdoc_dir = 'doc/rdoc'
42
42
  rdoc.title = "rawjsonrpc #{version}"
43
43
  rdoc.rdoc_files.include('README*')
44
44
  rdoc.rdoc_files.include('lib/**/*.rb')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -0,0 +1,238 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: README.rdoc [rawjsonrpc 0.1.0]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+
47
+
48
+ <div id="classindex-section" class="section project-section">
49
+ <h3 class="section-header">Class Index
50
+ <span class="search-toggle"><img src="./images/find.png"
51
+ height="16" width="16" alt="[+]"
52
+ title="show/hide quicksearch" /></span></h3>
53
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
54
+ <fieldset>
55
+ <legend>Quicksearch</legend>
56
+ <input type="text" name="quicksearch" value=""
57
+ class="quicksearch-field" />
58
+ </fieldset>
59
+ </form>
60
+
61
+ <ul class="link-list">
62
+
63
+ <li><a href="./RawJsonRpc.html">RawJsonRpc</a></li>
64
+
65
+ <li><a href="./RawJsonRpc/ClientSock.html">RawJsonRpc::ClientSock</a></li>
66
+
67
+ <li><a href="./RawJsonRpc/RawClientJsonRpc.html">RawJsonRpc::RawClientJsonRpc</a></li>
68
+
69
+ <li><a href="./RawJsonRpc/RawServerJsonRpc.html">RawJsonRpc::RawServerJsonRpc</a></li>
70
+
71
+ <li><a href="./RawJsonRpc/ServerSocket.html">RawJsonRpc::ServerSocket</a></li>
72
+
73
+ <li><a href="./RawJsonRpc/TCPServer.html">RawJsonRpc::TCPServer</a></li>
74
+
75
+ <li><a href="./RpcError.html">RpcError</a></li>
76
+
77
+ </ul>
78
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
79
+ </div>
80
+
81
+
82
+ </div>
83
+ </div>
84
+
85
+ <div id="documentation">
86
+
87
+ <h1>rawjsonrpc</h1>
88
+
89
+ <p>rawjsonrpc is a libary to create a jsonrpc client for every type of stream.
90
+ It also profides one client for tcpsocket, an server for one client and on
91
+ server based on gserver from the ruby stdlib. This is libary is a my first
92
+ try in ruby to create a gem. Its more a test how gems work but i hope i
93
+ can help somebody with this lib.</p>
94
+
95
+ <h2>load lib</h2>
96
+
97
+ <p>install libary</p>
98
+
99
+ <pre>gem install rawjsonrpc</pre>
100
+
101
+ <p>include rawjsonrpc in your programm</p>
102
+
103
+ <pre>require 'rawjsonrpc'</pre>
104
+
105
+ <h2>Use the TCP client </h2>
106
+
107
+ <p>Create a client to send rpc calls.</p>
108
+
109
+ <pre>client = RawJsonRpc::ClientSocket.new('192.168.2.10', 8080) #creates TCP client
110
+ ret = client.request(&quot;func1&quot;, nil) #calles func1 with no para
111
+ #returns result in ret
112
+ ret = client.request(&quot;func2&quot;, 1, 3.0, :test, &quot;om&quot;) #calles func2 with 4 paras
113
+ ret = client.func3([1, 2, 3, 4]) #calles func3 with a array
114
+ client.notification(&quot;noti&quot;, 1, &quot;t&quot;) #send notifaction no
115
+ # #return value
116
+ client.close()</pre>
117
+
118
+ <h2>Use server TCP simple</h2>
119
+
120
+ <p>Use the libary to serve functions over tcp ip.</p>
121
+
122
+ <pre>client = RawJsonRpc::SimpleServerSocket.new(8080)
123
+ client.add_method(&quot;func1&quot;, method(&quot;do_stuff1&quot;)) # adds do_stuff1 as &quot;func1&quot;
124
+ client.add_method(&quot;foo&quot;, method(:bar)) # adds bar as foo
125
+ client.add_block(&quot;func2&quot;){|a,b, *c| # adds a block with 2 args
126
+ #do stuff # and args as func2
127
+ }
128
+ client.serve()</pre>
129
+
130
+ <h2>use gserver TCP</h2>
131
+
132
+ <p>Lock in the stdlib for usage. The server delivers automaticly the
133
+ functions. Beware of adding methods or blocks after starting.</p>
134
+
135
+ <pre>server = RawJsonRpc::TCPServer.new(#args)</pre>
136
+
137
+ <h2>implement your own jsonclient</h2>
138
+
139
+ <p>Boilerplate Code to create your own client.</p>
140
+
141
+ <pre>class superclient &lt; RawJsonRpc::RawClientJsonRpc
142
+ def initiailize(*args)
143
+ # init stream
144
+ end
145
+
146
+ def send_request(jsonstring)
147
+ #send stream
148
+ end
149
+
150
+ def get_response
151
+ #return the response
152
+ end
153
+
154
+ def close
155
+ #close resources if needed
156
+ end
157
+ end</pre>
158
+
159
+ <h2>implement your server</h2>
160
+
161
+ <p>The boilerplattecode to create a new server.</p>
162
+
163
+ <pre>class superserver
164
+ include RawJsonRpc::RawServerJsonRpc
165
+
166
+ def initizial(*args)
167
+ #init
168
+ end
169
+
170
+ def serve
171
+ #get data from client
172
+ response = execute(jsonstring) #transfers the string and calls function
173
+ #return response string or nil if its a
174
+ # #notification
175
+ #send response
176
+ end
177
+
178
+ def end
179
+ #stuff
180
+ end
181
+ end</pre>
182
+
183
+ <h2>known issues</h2>
184
+ <ul><li>
185
+ <p>Block arguments can’t be checkt because they are blocks not lamdbas</p>
186
+ </li></ul>
187
+
188
+ <h2>Your implementations</h2>
189
+
190
+ <p>feel free to contribute your client and servers to the project.</p>
191
+
192
+ <h2>TODO </h2>
193
+ <ul><li>
194
+ <p>add examples</p>
195
+ </li><li>
196
+ <p>add doc for gserver implementation</p>
197
+ </li><li>
198
+ <p>add a piping server and client</p>
199
+ </li><li>
200
+ <p>fix block argumentchecks</p>
201
+ </li></ul>
202
+
203
+ <h2>Contributing to rawjsonrpc</h2>
204
+ <ul><li>
205
+ <p>Check out the latest master to make sure the feature hasn’t been
206
+ implemented or the bug hasn’t been fixed yet</p>
207
+ </li><li>
208
+ <p>Check out the issue tracker to make sure someone already hasn’t requested
209
+ it and/or contributed it</p>
210
+ </li><li>
211
+ <p>Fork the project</p>
212
+ </li><li>
213
+ <p>Start a feature/bugfix branch</p>
214
+ </li><li>
215
+ <p>Commit and push until you are happy with your contribution</p>
216
+ </li><li>
217
+ <p>Make sure to add tests for it. This is important so I don’t break it in a
218
+ future version unintentionally.</p>
219
+ </li><li>
220
+ <p>Please try not to mess with the Rakefile, version, or history. If you want
221
+ to have your own version, or is otherwise necessary, that is fine, but
222
+ please isolate to its own commit so I can cherry-pick around it.</p>
223
+ </li></ul>
224
+
225
+ <h2>Copyright</h2>
226
+
227
+ <p>Copyright © 2012 Alexander Schrode. See LICENSE.txt for further details.</p>
228
+
229
+ </div>
230
+
231
+ <div id="validator-badges">
232
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
233
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
234
+ Rdoc Generator</a> 2</small>.</p>
235
+ </div>
236
+ </body>
237
+ </html>
238
+
@@ -0,0 +1,244 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: RawJsonRpc::ClientSock</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../lib/rawjsonrpc/client_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/rawjsonrpc/client.rb">lib/rawjsonrpc/client.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link"><a href="RawClientJsonRpc.html">RawJsonRpc::RawClientJsonRpc</a></p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-new">::new</a></li>
69
+
70
+ <li><a href="#method-i-close">#close</a></li>
71
+
72
+ </ul>
73
+ </div>
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="project-metadata">
80
+
81
+
82
+ <div id="fileindex-section" class="section project-section">
83
+ <h3 class="section-header">Files</h3>
84
+ <ul>
85
+
86
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
87
+
88
+ </ul>
89
+ </div>
90
+
91
+
92
+ <div id="classindex-section" class="section project-section">
93
+ <h3 class="section-header">Class/Module Index
94
+ <span class="search-toggle"><img src="../images/find.png"
95
+ height="16" width="16" alt="[+]"
96
+ title="show/hide quicksearch" /></span></h3>
97
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
98
+ <fieldset>
99
+ <legend>Quicksearch</legend>
100
+ <input type="text" name="quicksearch" value=""
101
+ class="quicksearch-field" />
102
+ </fieldset>
103
+ </form>
104
+
105
+ <ul class="link-list">
106
+
107
+ <li><a href="../RawJsonRpc.html">RawJsonRpc</a></li>
108
+
109
+ <li><a href="../RawJsonRpc/ClientSock.html">RawJsonRpc::ClientSock</a></li>
110
+
111
+ <li><a href="../RawJsonRpc/RawClientJsonRpc.html">RawJsonRpc::RawClientJsonRpc</a></li>
112
+
113
+ <li><a href="../RawJsonRpc/RawServerJsonRpc.html">RawJsonRpc::RawServerJsonRpc</a></li>
114
+
115
+ <li><a href="../RawJsonRpc/ServerSocket.html">RawJsonRpc::ServerSocket</a></li>
116
+
117
+ <li><a href="../RawJsonRpc/TCPServer.html">RawJsonRpc::TCPServer</a></li>
118
+
119
+ <li><a href="../RpcError.html">RpcError</a></li>
120
+
121
+ </ul>
122
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
123
+ </div>
124
+
125
+
126
+ </div>
127
+ </div>
128
+
129
+ <div id="documentation">
130
+ <h1 class="class">RawJsonRpc::ClientSock</h1>
131
+
132
+ <div id="description" class="description">
133
+
134
+ <p>Implements the raw json rpc client over a tcp socket. Includes the
135
+ RawClientJsonRpcBase Module</p>
136
+
137
+ </div><!-- description -->
138
+
139
+
140
+
141
+
142
+ <div id="5Buntitled-5D" class="documentation-section">
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ <!-- Methods -->
152
+
153
+ <div id="public-class-method-details" class="method-section section">
154
+ <h3 class="section-header">Public Class Methods</h3>
155
+
156
+
157
+ <div id="new-method" class="method-detail ">
158
+ <a name="method-c-new"></a>
159
+
160
+
161
+ <div class="method-heading">
162
+ <span class="method-name">new</span><span
163
+ class="method-args">(ip, port)</span>
164
+ <span class="method-click-advice">click to toggle source</span>
165
+ </div>
166
+
167
+
168
+ <div class="method-description">
169
+
170
+ <p>Init the socket with host.</p>
171
+
172
+
173
+
174
+ <div class="method-source-code" id="new-source">
175
+ <pre>
176
+ <span class="ruby-comment"># File lib/rawjsonrpc/client.rb, line 95</span>
177
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ip</span>, <span class="ruby-identifier">port</span>)
178
+ <span class="ruby-ivar">@socket</span> = <span class="ruby-constant">TCPSocket</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ip</span>, <span class="ruby-identifier">port</span>)
179
+ <span class="ruby-keyword">end</span></pre>
180
+ </div><!-- new-source -->
181
+
182
+ </div>
183
+
184
+
185
+
186
+
187
+ </div><!-- new-method -->
188
+
189
+
190
+ </div><!-- public-class-method-details -->
191
+
192
+ <div id="public-instance-method-details" class="method-section section">
193
+ <h3 class="section-header">Public Instance Methods</h3>
194
+
195
+
196
+ <div id="close-method" class="method-detail ">
197
+ <a name="method-i-close"></a>
198
+
199
+
200
+ <div class="method-heading">
201
+ <span class="method-name">close</span><span
202
+ class="method-args">()</span>
203
+ <span class="method-click-advice">click to toggle source</span>
204
+ </div>
205
+
206
+
207
+ <div class="method-description">
208
+
209
+ <p>closes the socket connection</p>
210
+
211
+
212
+
213
+ <div class="method-source-code" id="close-source">
214
+ <pre>
215
+ <span class="ruby-comment"># File lib/rawjsonrpc/client.rb, line 99</span>
216
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>
217
+ <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span>
218
+ <span class="ruby-keyword">end</span></pre>
219
+ </div><!-- close-source -->
220
+
221
+ </div>
222
+
223
+
224
+
225
+
226
+ </div><!-- close-method -->
227
+
228
+
229
+ </div><!-- public-instance-method-details -->
230
+
231
+ </div><!-- 5Buntitled-5D -->
232
+
233
+
234
+ </div><!-- documentation -->
235
+
236
+ <div id="validator-badges">
237
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
238
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
239
+ Rdoc Generator</a> 2</small>.</p>
240
+ </div>
241
+
242
+ </body>
243
+ </html>
244
+