json-rpc-objects 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -12
- data/VERSION +1 -1
- data/json-rpc-objects.gemspec +2 -2
- data/lib/json-rpc-objects/error.rb +7 -17
- data/lib/json-rpc-objects/request.rb +12 -14
- data/lib/json-rpc-objects/response.rb +12 -13
- metadata +5 -5
data/README.md
CHANGED
@@ -16,15 +16,16 @@ It means, it implements following JSON-RPC versions:
|
|
16
16
|
|
17
17
|
### Protocol Versions Compatibility
|
18
18
|
|
19
|
-
All protocols are implemented from
|
20
|
-
complain to. Some of these aren't encouraged, but it's
|
21
|
-
user. 2.0 and 1.1 Alt
|
22
|
-
specification such as object extensions as defined in
|
23
|
-
mainly because of API compatibility and functionallity
|
19
|
+
All protocols are implemented from point of view of features which must
|
20
|
+
complain to. Some of these features aren't encouraged to use, but it's
|
21
|
+
on will of the user. 2.0 and 1.1 Alt implement some minor additions
|
22
|
+
in comparing to specification such as object extensions as defined in
|
23
|
+
1.1 WD, but mainly because of API compatibility and functionallity
|
24
|
+
reasons.
|
24
25
|
|
25
|
-
All classes inherit from previous version so API is
|
26
|
-
Application which can deal with 1.0 can deal with 2.0 too
|
27
|
-
funcionallity or logic lost.
|
26
|
+
All classes inherit from previous protocol version classes so API is
|
27
|
+
homogenous. Application which can deal with 1.0 can deal with 2.0 too
|
28
|
+
without any funcionallity or logic lost.
|
28
29
|
|
29
30
|
### Usage
|
30
31
|
|
@@ -39,7 +40,7 @@ members),
|
|
39
40
|
All names of both class names and optional arguments are exactly the
|
40
41
|
same as defined in specification.
|
41
42
|
|
42
|
-
|
43
|
+
Library can be used by two ways. You know either concrete version of the
|
43
44
|
protocol which you want to use in your application (typically client)
|
44
45
|
or you process some incoming request which can use whatever of
|
45
46
|
the versions (typically server).
|
@@ -81,9 +82,9 @@ achieved by simple way:
|
|
81
82
|
This code analyzes protocol version of the request and creates response
|
82
83
|
of the same protocol version. It utilizes call handler, so you can call
|
83
84
|
for example `request.class::version.service_procedure_description::create(<arguments>)`
|
84
|
-
for obtaining 1.1 service procedure description object. But be warn
|
85
|
-
|
86
|
-
|
85
|
+
for obtaining 1.1 service procedure description object. But be warn,
|
86
|
+
neither 1.0 nor 2.0 implements these objects, so it can simply cause
|
87
|
+
`LoadError` in that case, therefore it really isn't recommended.
|
87
88
|
|
88
89
|
Be limited by `Error`, `Request` and `Response` classes here or check
|
89
90
|
the protocol version using `#VERSION` class constant. Also note,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/json-rpc-objects.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{json-rpc-objects}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Kozák"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-30}
|
13
13
|
s.email = %q{martinkozak@martinkozak.net}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -8,22 +8,12 @@ require "json-rpc-objects/v20/error"
|
|
8
8
|
module JsonRpcObjects
|
9
9
|
|
10
10
|
##
|
11
|
-
#
|
11
|
+
# Emulates access to 2.0 error class.
|
12
12
|
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# @param [Array] args for target constructor
|
20
|
-
# @return [JsonRpcObjects::V20::Error] error object
|
21
|
-
#
|
22
|
-
|
23
|
-
def self.create(*args)
|
24
|
-
JsonRpcObjects::V20::Error::create(*args)
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
13
|
+
# @see JsonRpcObjects::V20::Error
|
14
|
+
# @since 0.2.0
|
15
|
+
#
|
16
|
+
|
17
|
+
Error = JsonRpcObjects::V20::Error
|
18
|
+
|
29
19
|
end
|
@@ -9,10 +9,20 @@ require "yajl/json_gem"
|
|
9
9
|
module JsonRpcObjects
|
10
10
|
|
11
11
|
##
|
12
|
-
#
|
12
|
+
# Emulates access to 2.0 request class.
|
13
|
+
#
|
14
|
+
# @see JsonRpcObjects::V20::Request
|
15
|
+
# @since 0.2.0
|
16
|
+
#
|
17
|
+
|
18
|
+
Request = JsonRpcObjects::V20::Request
|
19
|
+
|
20
|
+
##
|
21
|
+
# Request class for version detection and universal API.
|
22
|
+
# @since 0.2.0
|
13
23
|
#
|
14
24
|
|
15
|
-
|
25
|
+
class Request
|
16
26
|
|
17
27
|
##
|
18
28
|
# Parses JSON-RPC string for request and uses differential
|
@@ -58,18 +68,6 @@ module JsonRpcObjects
|
|
58
68
|
require file
|
59
69
|
return cls::new(data)
|
60
70
|
end
|
61
|
-
|
62
|
-
|
63
|
-
##
|
64
|
-
# Returns request of the latest standard.
|
65
|
-
#
|
66
|
-
# @param [Array] args for target constructor
|
67
|
-
# @return [JsonRpcObjects::V20::Request] request object
|
68
|
-
#
|
69
|
-
|
70
|
-
def self.create(*args)
|
71
|
-
JsonRpcObjects::V20::Request::create(*args)
|
72
|
-
end
|
73
71
|
|
74
72
|
end
|
75
73
|
|
@@ -8,10 +8,20 @@ require "json-rpc-objects/v20/response"
|
|
8
8
|
module JsonRpcObjects
|
9
9
|
|
10
10
|
##
|
11
|
-
#
|
11
|
+
# Emulates access to 2.0 response class.
|
12
|
+
#
|
13
|
+
# @see JsonRpcObjects::V20::Response
|
14
|
+
# @since 0.2.0
|
15
|
+
#
|
16
|
+
|
17
|
+
Response = JsonRpcObjects::V20::Response
|
18
|
+
|
19
|
+
##
|
20
|
+
# Response class for version detection and universal API.
|
21
|
+
# @since 0.2.0
|
12
22
|
#
|
13
23
|
|
14
|
-
|
24
|
+
class Response
|
15
25
|
|
16
26
|
##
|
17
27
|
# Parses JSON-RPC string for response and uses differential
|
@@ -57,17 +67,6 @@ module JsonRpcObjects
|
|
57
67
|
return cls::new(data)
|
58
68
|
end
|
59
69
|
|
60
|
-
##
|
61
|
-
# Returns request of the latest standard.
|
62
|
-
#
|
63
|
-
# @param [Array] args for target constructor
|
64
|
-
# @return [JsonRpcObjects::V20::Response] response object
|
65
|
-
#
|
66
|
-
|
67
|
-
def self.create(*args)
|
68
|
-
JsonRpcObjects::V20::Response::create(*args)
|
69
|
-
end
|
70
|
-
|
71
70
|
end
|
72
71
|
|
73
72
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Martin Koz\xC3\xA1k"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-30 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
requirements:
|
193
193
|
- - ">="
|
194
194
|
- !ruby/object:Gem::Version
|
195
|
-
hash:
|
195
|
+
hash: 223533265713224733
|
196
196
|
segments:
|
197
197
|
- 0
|
198
198
|
version: "0"
|