rack-rpc 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{AUTHORS → AUTHORS.md} +1 -1
- data/README.md +166 -0
- data/{UNLICENSE → UNLICENSE.md} +0 -0
- data/VERSION.txt +1 -0
- data/lib/rack/rpc/version.rb +1 -1
- metadata +41 -56
- data/CREDITS +0 -0
- data/README +0 -149
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c52f2a2cbb56a77083080ffa9b54e20bad4c1900
|
4
|
+
data.tar.gz: 73c27439d83c02817f531d827d81ac384cb6b5cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0f0d483d5e15203fdbb3cc7145c29ebeee1fb20db824ad55f297550aefbd262bd7e89a860539662ad25f8ef9c007b3cdefcf3d1cee15cd4d1e5cd94768e06fa
|
7
|
+
data.tar.gz: 82303a7c0600e0162ff5c20ac11de4c9123c33124532738fc29cc15c001582a099a1464260129f56667739fda202beb71ef8454533ffdf0e0fc187a191d3dbe7
|
data/{AUTHORS → AUTHORS.md}
RENAMED
data/README.md
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
JSON-RPC/XML-RPC Server for Rack Applications
|
2
|
+
=============================================
|
3
|
+
|
4
|
+
[![Build Status](https://secure.travis-ci.org/rack-rpc/rack-rpc.png?branch=master)](http://travis-ci.org/rack-rpc/rack-rpc)
|
5
|
+
|
6
|
+
Version: {include:file:VERSION.txt}
|
7
|
+
|
8
|
+
* The latest documentation can always be found at <http://rack-rpc.github.io/rack-rpc>.
|
9
|
+
* Source code repository lives [here, at GitHub](http://github.com/rack-rpc/rack-rpc).
|
10
|
+
* The gems can be found [here, at RubyGems](http://rubygems.org/gems/rack-rpc).
|
11
|
+
|
12
|
+
**Rack::RPC** is [Rack][] middleware that facilitates the creation of
|
13
|
+
protocol-agnostic RPC servers. The current implementation provides support
|
14
|
+
for [JSON-RPC 2.0][] and [XML-RPC][].
|
15
|
+
|
16
|
+
* Handles JSON-RPC and XML-RPC requests with the same code.
|
17
|
+
* Compatible with any Rack application and any Rack-based framework.
|
18
|
+
* Provides Rails-style controller filtering for your RPC methods.
|
19
|
+
|
20
|
+
|
21
|
+
Examples
|
22
|
+
--------
|
23
|
+
|
24
|
+
### A basic RPC server
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'rack/rpc'
|
28
|
+
|
29
|
+
class Server < Rack::RPC::Server
|
30
|
+
def hello_world
|
31
|
+
"Hello, world!"
|
32
|
+
end
|
33
|
+
rpc 'hello_world' => :hello_world
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
### Simple filtering
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
require 'rack/rpc'
|
41
|
+
|
42
|
+
class Server < Rack::RPC::Server
|
43
|
+
before_filter :check_auth
|
44
|
+
|
45
|
+
def hello_world
|
46
|
+
"Hello, world!"
|
47
|
+
end
|
48
|
+
rpc 'hello_world' => :hello_world
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def check_auth
|
53
|
+
raise "Not authorized" unless authorized
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
### Filtering via a proc with more options
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require 'rack/rpc'
|
62
|
+
|
63
|
+
class Server < Rack::RPC::Server
|
64
|
+
before_filter :check_auth, :only => :super_secret_hello_world do
|
65
|
+
raise "Not authorized" unless authorized
|
66
|
+
end
|
67
|
+
|
68
|
+
def hello_world
|
69
|
+
"Hello, world!"
|
70
|
+
end
|
71
|
+
rpc 'hello_world' => :hello_world
|
72
|
+
|
73
|
+
def super_secret_hello_world
|
74
|
+
'super_secret_hello_world'
|
75
|
+
end
|
76
|
+
rpc 'super_secret_hello_world' => :super_secret_hello_world
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
### Running the server
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
# config.ru
|
84
|
+
use Rack::RPC::Endpoint, Server.new
|
85
|
+
|
86
|
+
run MyApplication
|
87
|
+
```
|
88
|
+
|
89
|
+
### Customizing the default RPC path
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
# config.ru
|
93
|
+
use Rack::RPC::Endpoint, Server.new, :path => '/api'
|
94
|
+
|
95
|
+
run MyApplication
|
96
|
+
```
|
97
|
+
|
98
|
+
|
99
|
+
More on Filters
|
100
|
+
---------------
|
101
|
+
|
102
|
+
The `:only` and `:except` options for filters can take a single method or an
|
103
|
+
array of methods.
|
104
|
+
|
105
|
+
You can halt execution in a filter by raising an exception. An error
|
106
|
+
response will be returned with the exception's message set as the error
|
107
|
+
object's message text.
|
108
|
+
|
109
|
+
|
110
|
+
Communicationg with the Server
|
111
|
+
------------------------------
|
112
|
+
|
113
|
+
By default, methods will only be invoked on `POST` requests to "/rpc". The
|
114
|
+
default path can be overridden by sending a `:path` option when creating
|
115
|
+
your middleware (see example above).
|
116
|
+
|
117
|
+
The protocol used is determined by the `CONTENT_TYPE` header
|
118
|
+
("application/xml" and "text/xml" for XML and "application/json" for JSON).
|
119
|
+
|
120
|
+
|
121
|
+
Dependencies
|
122
|
+
------------
|
123
|
+
|
124
|
+
* [Rack](http://rubygems.org/gems/rack) (>= 1.0.0)
|
125
|
+
* [Builder](http://rubygems.org/gems/builder) (>= 2.1.2)
|
126
|
+
|
127
|
+
|
128
|
+
Installation
|
129
|
+
------------
|
130
|
+
|
131
|
+
The recommended installation method is via [RubyGems](https://rubygems.org/).
|
132
|
+
To install the latest official release of the gem, run:
|
133
|
+
|
134
|
+
```bash
|
135
|
+
gem install rack-rpc
|
136
|
+
```
|
137
|
+
|
138
|
+
To get a local working copy of the development repository, do:
|
139
|
+
|
140
|
+
```bash
|
141
|
+
git clone git://github.com/rack-rpc/rack-rpc.git
|
142
|
+
```
|
143
|
+
|
144
|
+
Alternatively, download the latest development version as a tarball as
|
145
|
+
follows:
|
146
|
+
|
147
|
+
```bash
|
148
|
+
wget https://github.com/rack-rpc/rack-rpc/tarball/master
|
149
|
+
```
|
150
|
+
|
151
|
+
Authors
|
152
|
+
-------
|
153
|
+
|
154
|
+
* [Arto Bendiken](https://github.com/bendiken) - <http://ar.to/>
|
155
|
+
* [Josh Huckabee](https://github.com/jhuckabee) - <http://joshhuckabee.com/>
|
156
|
+
* [Vincent Landgraf](https://github.com/threez)
|
157
|
+
|
158
|
+
License
|
159
|
+
-------
|
160
|
+
|
161
|
+
This is free and unencumbered public domain software. For more information,
|
162
|
+
see <http://unlicense.org/> or the accompanying {file:UNLICENSE.md} file.
|
163
|
+
|
164
|
+
[Rack]: http://rack.github.io/
|
165
|
+
[JSON-RPC 2.0]: http://www.jsonrpc.org/
|
166
|
+
[XML-RPC]: http://www.xmlrpc.com/
|
data/{UNLICENSE → UNLICENSE.md}
RENAMED
File without changes
|
data/VERSION.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.12
|
data/lib/rack/rpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,139 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Arto Bendiken
|
8
|
+
- Josh Huckabee
|
8
9
|
- Vincent Landgraf
|
9
|
-
autorequire:
|
10
|
+
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
13
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: builder
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.1.2
|
21
|
-
|
21
|
+
name: builder
|
22
22
|
prerelease: false
|
23
|
+
type: :runtime
|
23
24
|
version_requirements: !ruby/object:Gem::Requirement
|
24
25
|
requirements:
|
25
|
-
- -
|
26
|
+
- - ~>
|
26
27
|
- !ruby/object:Gem::Version
|
27
28
|
version: 2.1.2
|
28
29
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: rack
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.0'
|
35
|
-
|
35
|
+
name: rack
|
36
36
|
prerelease: false
|
37
|
+
type: :runtime
|
37
38
|
version_requirements: !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
|
-
- -
|
40
|
+
- - ~>
|
40
41
|
- !ruby/object:Gem::Version
|
41
42
|
version: '1.0'
|
42
43
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
|
-
|
49
|
+
name: rake
|
50
50
|
prerelease: false
|
51
|
+
type: :development
|
51
52
|
version_requirements: !ruby/object:Gem::Requirement
|
52
53
|
requirements:
|
53
54
|
- - '>='
|
54
55
|
- !ruby/object:Gem::Version
|
55
56
|
version: '0'
|
56
57
|
- !ruby/object:Gem::Dependency
|
57
|
-
name: json
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.7
|
63
|
-
|
62
|
+
version: '1.7'
|
63
|
+
name: json
|
64
64
|
prerelease: false
|
65
|
+
type: :development
|
65
66
|
version_requirements: !ruby/object:Gem::Requirement
|
66
67
|
requirements:
|
67
68
|
- - ~>
|
68
69
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.7
|
70
|
+
version: '1.7'
|
70
71
|
- !ruby/object:Gem::Dependency
|
71
|
-
name: nokogiri
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 1.4.4
|
77
|
-
|
77
|
+
name: nokogiri
|
78
78
|
prerelease: false
|
79
|
+
type: :development
|
79
80
|
version_requirements: !ruby/object:Gem::Requirement
|
80
81
|
requirements:
|
81
|
-
- -
|
82
|
+
- - ~>
|
82
83
|
- !ruby/object:Gem::Version
|
83
84
|
version: 1.4.4
|
84
85
|
- !ruby/object:Gem::Dependency
|
85
|
-
name: yard
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 0.6.0
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - '>='
|
88
|
+
- - ~>
|
96
89
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
98
|
-
- !ruby/object:Gem::Dependency
|
90
|
+
version: '2.1'
|
99
91
|
name: rspec
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - '>='
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 2.1.0
|
105
|
-
type: :development
|
106
92
|
prerelease: false
|
93
|
+
type: :development
|
107
94
|
version_requirements: !ruby/object:Gem::Requirement
|
108
95
|
requirements:
|
109
|
-
- -
|
96
|
+
- - ~>
|
110
97
|
- !ruby/object:Gem::Version
|
111
|
-
version: 2.1
|
98
|
+
version: '2.1'
|
112
99
|
- !ruby/object:Gem::Dependency
|
113
|
-
name: rack-test
|
114
100
|
requirement: !ruby/object:Gem::Requirement
|
115
101
|
requirements:
|
116
|
-
- -
|
102
|
+
- - ~>
|
117
103
|
- !ruby/object:Gem::Version
|
118
104
|
version: 0.5.6
|
119
|
-
|
105
|
+
name: rack-test
|
120
106
|
prerelease: false
|
107
|
+
type: :development
|
121
108
|
version_requirements: !ruby/object:Gem::Requirement
|
122
109
|
requirements:
|
123
|
-
- -
|
110
|
+
- - ~>
|
124
111
|
- !ruby/object:Gem::Version
|
125
112
|
version: 0.5.6
|
126
|
-
description: Rack middleware for serving
|
127
|
-
email:
|
113
|
+
description: Rack middleware for serving RPC endpoints.
|
114
|
+
email: pieterb@djinnit.com
|
128
115
|
executables: []
|
129
116
|
extensions: []
|
130
117
|
extra_rdoc_files: []
|
131
118
|
files:
|
132
|
-
- AUTHORS
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
- VERSION
|
119
|
+
- AUTHORS.md
|
120
|
+
- README.md
|
121
|
+
- UNLICENSE.md
|
122
|
+
- VERSION.txt
|
137
123
|
- lib/rack/rpc.rb
|
138
124
|
- lib/rack/rpc/endpoint.rb
|
139
125
|
- lib/rack/rpc/endpoint/jsonrpc.rb
|
@@ -148,7 +134,7 @@ homepage: https://github.com/rack-rpc/rack-rpc
|
|
148
134
|
licenses:
|
149
135
|
- Public Domain
|
150
136
|
metadata: {}
|
151
|
-
post_install_message:
|
137
|
+
post_install_message:
|
152
138
|
rdoc_options: []
|
153
139
|
require_paths:
|
154
140
|
- lib
|
@@ -163,10 +149,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
149
|
- !ruby/object:Gem::Version
|
164
150
|
version: '0'
|
165
151
|
requirements: []
|
166
|
-
rubyforge_project:
|
152
|
+
rubyforge_project:
|
167
153
|
rubygems_version: 2.2.2
|
168
|
-
signing_key:
|
154
|
+
signing_key:
|
169
155
|
specification_version: 4
|
170
156
|
summary: JSON-RPC/XML-RPC server for Rack applications.
|
171
157
|
test_files: []
|
172
|
-
has_rdoc: false
|
data/CREDITS
DELETED
File without changes
|
data/README
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
JSON-RPC/XML-RPC Server for Rack Applications [![Build Status](https://secure.travis-ci.org/threez/rack-rpc.png?branch=master)](http://travis-ci.org/threez/rack-rpc)
|
2
|
-
=============================================
|
3
|
-
|
4
|
-
This is a [Rack][] middleware that facilitates the creation of
|
5
|
-
protocol-agnostic RPC servers. The current implementation provides support
|
6
|
-
for [JSON-RPC 2.0][] and [XML-RPC][].
|
7
|
-
|
8
|
-
* <https://github.com/datagraph/rack-rpc>
|
9
|
-
|
10
|
-
Features
|
11
|
-
--------
|
12
|
-
|
13
|
-
* Handles JSON-RPC and XML-RPC requests with the same code.
|
14
|
-
* Compatible with any Rack application and any Rack-based framework.
|
15
|
-
* Provides Rails-style controller filtering for your RPC methods.
|
16
|
-
|
17
|
-
Examples
|
18
|
-
--------
|
19
|
-
|
20
|
-
### A basic RPC server
|
21
|
-
|
22
|
-
require 'rack/rpc'
|
23
|
-
|
24
|
-
class Server < Rack::RPC::Server
|
25
|
-
def hello_world
|
26
|
-
"Hello, world!"
|
27
|
-
end
|
28
|
-
rpc 'hello_world' => :hello_world
|
29
|
-
end
|
30
|
-
|
31
|
-
### Simple filtering
|
32
|
-
|
33
|
-
require 'rack/rpc'
|
34
|
-
|
35
|
-
class Server < Rack::RPC::Server
|
36
|
-
before_filter :check_auth
|
37
|
-
|
38
|
-
def hello_world
|
39
|
-
"Hello, world!"
|
40
|
-
end
|
41
|
-
rpc 'hello_world' => :hello_world
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def check_auth
|
46
|
-
raise "Not authorized" unless authorized
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
### Filtering via a proc with more options
|
51
|
-
|
52
|
-
require 'rack/rpc'
|
53
|
-
|
54
|
-
class Server < Rack::RPC::Server
|
55
|
-
before_filter :check_auth, :only => :super_secret_hello_world do
|
56
|
-
raise "Not authorized" unless authorized
|
57
|
-
end
|
58
|
-
|
59
|
-
def hello_world
|
60
|
-
"Hello, world!"
|
61
|
-
end
|
62
|
-
rpc 'hello_world' => :hello_world
|
63
|
-
|
64
|
-
def super_secret_hello_world
|
65
|
-
'super_secret_hello_world'
|
66
|
-
end
|
67
|
-
rpc 'super_secret_hello_world' => :super_secret_hello_world
|
68
|
-
end
|
69
|
-
|
70
|
-
### Running the server
|
71
|
-
|
72
|
-
# config.ru
|
73
|
-
use Rack::RPC::Endpoint, Server.new
|
74
|
-
|
75
|
-
run MyApplication
|
76
|
-
|
77
|
-
### Customizing the default RPC path
|
78
|
-
|
79
|
-
# config.ru
|
80
|
-
use Rack::RPC::Endpoint, Server.new, :path => '/api'
|
81
|
-
|
82
|
-
run MyApplication
|
83
|
-
|
84
|
-
More on Filters
|
85
|
-
---------------
|
86
|
-
|
87
|
-
The `:only` and `:except` options for filters can take a single method or an
|
88
|
-
array of methods.
|
89
|
-
|
90
|
-
You can halt execution in a filter by raising an exception. An error
|
91
|
-
response will be returned with the exception's message set as the error
|
92
|
-
object's message text.
|
93
|
-
|
94
|
-
Communicationg with the Server
|
95
|
-
------------------------------
|
96
|
-
|
97
|
-
By default, methods will only be invoked on `POST` requests to "/rpc". The
|
98
|
-
default path can be overridden by sending a `:path` option when creating
|
99
|
-
your middleware (see example above).
|
100
|
-
|
101
|
-
The protocol used is determined by the `CONTENT_TYPE` header
|
102
|
-
("application/xml" and "text/xml" for XML and "application/json" for JSON).
|
103
|
-
|
104
|
-
Dependencies
|
105
|
-
------------
|
106
|
-
|
107
|
-
* [Rack](http://rubygems.org/gems/rack) (>= 1.0.0)
|
108
|
-
* [Builder](http://rubygems.org/gems/builder) (>= 2.1.2)
|
109
|
-
|
110
|
-
Installation
|
111
|
-
------------
|
112
|
-
|
113
|
-
The recommended installation method is via [RubyGems](http://rubygems.org/).
|
114
|
-
To install the latest official release of the gem, do:
|
115
|
-
|
116
|
-
% [sudo] gem install rack-rpc
|
117
|
-
|
118
|
-
Download
|
119
|
-
--------
|
120
|
-
|
121
|
-
To get a local working copy of the development repository, do:
|
122
|
-
|
123
|
-
% git clone git://github.com/datagraph/rack-rpc.git
|
124
|
-
|
125
|
-
Alternatively, download the latest development version as a tarball as
|
126
|
-
follows:
|
127
|
-
|
128
|
-
% wget http://github.com/datagraph/rack-rpc/tarball/master
|
129
|
-
|
130
|
-
Mailing List
|
131
|
-
------------
|
132
|
-
|
133
|
-
* <http://groups.google.com/group/rack-devel>
|
134
|
-
|
135
|
-
Authors
|
136
|
-
-------
|
137
|
-
|
138
|
-
* [Arto Bendiken](https://github.com/bendiken) - <http://ar.to/>
|
139
|
-
* [Josh Huckabee](https://github.com/jhuckabee) - <http://joshhuckabee.com/>
|
140
|
-
|
141
|
-
License
|
142
|
-
-------
|
143
|
-
|
144
|
-
This is free and unencumbered public domain software. For more information,
|
145
|
-
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
146
|
-
|
147
|
-
[Rack]: http://rack.rubyforge.org/
|
148
|
-
[JSON-RPC 2.0]: http://groups.google.com/group/json-rpc/web/json-rpc-2-0
|
149
|
-
[XML-RPC]: http://www.xmlrpc.com/
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.11
|