json-rpc-objects 0.3.2 → 0.3.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/CHANGES.txt +3 -0
- data/VERSION +1 -1
- data/json-rpc-objects.gemspec +3 -3
- data/lib/json-rpc-objects/request.rb +16 -6
- data/lib/json-rpc-objects/response.rb +15 -5
- data/lib/json-rpc-objects/version.rb +11 -1
- metadata +4 -4
data/CHANGES.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
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.3.
|
8
|
+
s.version = "0.3.3"
|
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-02-
|
12
|
+
s.date = %q{2011-02-13}
|
13
13
|
s.email = %q{martinkozak@martinkozak.net}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -70,7 +70,7 @@ Gem::Specification.new do |s|
|
|
70
70
|
s.homepage = %q{http://github.com/martinkozak/json-rpc-objects}
|
71
71
|
s.licenses = ["MIT"]
|
72
72
|
s.require_paths = ["lib"]
|
73
|
-
s.rubygems_version = %q{1.5.
|
73
|
+
s.rubygems_version = %q{1.5.2}
|
74
74
|
s.summary = %q{Implementation of JSON-RPC objects with respect to specifications compliance and API backward compatibility. Implements all versions of the protocol and support for ability to communicate by the same protocol version which other side uses by a transparent way.}
|
75
75
|
|
76
76
|
if s.respond_to? :specification_version then
|
@@ -23,7 +23,13 @@ module JsonRpcObjects
|
|
23
23
|
#
|
24
24
|
|
25
25
|
class Request
|
26
|
-
|
26
|
+
|
27
|
+
##
|
28
|
+
# Holds loaded files indicator.
|
29
|
+
#
|
30
|
+
|
31
|
+
@@files = { }
|
32
|
+
|
27
33
|
##
|
28
34
|
# Parses JSON-RPC string for request and uses differential
|
29
35
|
# heuristic for detecting the right class.
|
@@ -45,14 +51,14 @@ module JsonRpcObjects
|
|
45
51
|
raise Exception::new("Data in JSON string aren't object.")
|
46
52
|
end
|
47
53
|
|
48
|
-
data.keys_to_sym!
|
54
|
+
#data.keys_to_sym!
|
49
55
|
|
50
56
|
# Detects
|
51
|
-
if data.include?
|
57
|
+
if data.include? "jsonrpc"
|
52
58
|
file = "json-rpc-objects/v20/request"
|
53
59
|
cls = V20::Request
|
54
|
-
elsif data.include?
|
55
|
-
if (default_v11 == :alt) or (data.include?
|
60
|
+
elsif data.include? "version"
|
61
|
+
if (default_v11 == :alt) or (data.include? "kwparams")
|
56
62
|
file = "json-rpc-objects/v11/alt/procedure-call"
|
57
63
|
cls = V11::Alt::ProcedureCall
|
58
64
|
else
|
@@ -65,7 +71,11 @@ module JsonRpcObjects
|
|
65
71
|
end
|
66
72
|
|
67
73
|
# Returns
|
68
|
-
|
74
|
+
if not @@files.has_key? file
|
75
|
+
require file
|
76
|
+
@@files[file] = true
|
77
|
+
end
|
78
|
+
|
69
79
|
return cls::new(data)
|
70
80
|
end
|
71
81
|
|
@@ -22,6 +22,12 @@ module JsonRpcObjects
|
|
22
22
|
#
|
23
23
|
|
24
24
|
class Response
|
25
|
+
|
26
|
+
##
|
27
|
+
# Holds loaded files indicator.
|
28
|
+
#
|
29
|
+
|
30
|
+
@@files = { }
|
25
31
|
|
26
32
|
##
|
27
33
|
# Parses JSON-RPC string for response and uses differential
|
@@ -43,14 +49,14 @@ module JsonRpcObjects
|
|
43
49
|
raise Exception::new("Data in JSON string aren't object.")
|
44
50
|
end
|
45
51
|
|
46
|
-
data.keys_to_sym!
|
52
|
+
#data.keys_to_sym!
|
47
53
|
|
48
54
|
# Detects
|
49
|
-
if data.include?
|
55
|
+
if data.include? "jsonrpc"
|
50
56
|
file = "json-rpc-objects/v20/response"
|
51
57
|
cls = V20::Response
|
52
|
-
elsif data.include?
|
53
|
-
if (default_v11 == :wd) or ((data.include?
|
58
|
+
elsif data.include? "version"
|
59
|
+
if (default_v11 == :wd) or ((data.include? "error") and (data["error"].kind_of? Hash) and (data["error"].include? "name"))
|
54
60
|
file = "json-rpc-objects/v11/wd/procedure-return"
|
55
61
|
cls = V11::WD::ProcedureReturn
|
56
62
|
else
|
@@ -63,7 +69,11 @@ module JsonRpcObjects
|
|
63
69
|
end
|
64
70
|
|
65
71
|
# Returns
|
66
|
-
|
72
|
+
if not @@files.has_key? file
|
73
|
+
require file
|
74
|
+
@@files[file] = true
|
75
|
+
end
|
76
|
+
|
67
77
|
return cls::new(data)
|
68
78
|
end
|
69
79
|
|
@@ -35,6 +35,12 @@ module JsonRpcObjects
|
|
35
35
|
#
|
36
36
|
|
37
37
|
@@cache = { }
|
38
|
+
|
39
|
+
##
|
40
|
+
# Holds loaded files indicator.
|
41
|
+
#
|
42
|
+
|
43
|
+
@@files = { }
|
38
44
|
|
39
45
|
##
|
40
46
|
# Returns version object for appropriate version module.
|
@@ -78,7 +84,11 @@ module JsonRpcObjects
|
|
78
84
|
file_path.gsub!("::", "/")
|
79
85
|
file_path.downcase!
|
80
86
|
|
81
|
-
|
87
|
+
if not @@files.has_key? file_path
|
88
|
+
require file_path
|
89
|
+
@@files[file_path] = true
|
90
|
+
end
|
91
|
+
|
82
92
|
return Kernel::eval(module_name)
|
83
93
|
end
|
84
94
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: json-rpc-objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Martin Koz\xC3\xA1k"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-13 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements:
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
hash:
|
167
|
+
hash: 4515745036204370160
|
168
168
|
segments:
|
169
169
|
- 0
|
170
170
|
version: "0"
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements: []
|
178
178
|
|
179
179
|
rubyforge_project:
|
180
|
-
rubygems_version: 1.5.
|
180
|
+
rubygems_version: 1.5.2
|
181
181
|
signing_key:
|
182
182
|
specification_version: 3
|
183
183
|
summary: Implementation of JSON-RPC objects with respect to specifications compliance and API backward compatibility. Implements all versions of the protocol and support for ability to communicate by the same protocol version which other side uses by a transparent way.
|