json-rpc-objects 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +8 -1
- data/Gemfile +5 -6
- data/Gemfile.lock +12 -15
- data/LICENSE.txt +1 -1
- data/Rakefile +3 -11
- data/VERSION +1 -1
- data/json-rpc-objects.gemspec +21 -24
- data/lib/json-rpc-objects/generic/error.rb +2 -0
- data/lib/json-rpc-objects/generic/object.rb +11 -26
- data/lib/json-rpc-objects/generic/request.rb +2 -0
- data/lib/json-rpc-objects/generic/response.rb +2 -0
- data/lib/json-rpc-objects/request.rb +5 -4
- data/lib/json-rpc-objects/response.rb +5 -3
- data/lib/json-rpc-objects/v10/error.rb +2 -0
- data/lib/json-rpc-objects/v10/request.rb +6 -3
- data/lib/json-rpc-objects/v10/response.rb +2 -0
- data/lib/json-rpc-objects/v10/tests/test.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/error.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/fakes/request.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/fakes/response.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/procedure-call.rb +3 -1
- data/lib/json-rpc-objects/v11/alt/procedure-parameter-description.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/procedure-return.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/request.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/response.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/service-description.rb +2 -0
- data/lib/json-rpc-objects/v11/alt/service-procedure-description.rb +4 -1
- data/lib/json-rpc-objects/v11/alt/tests/test.rb +2 -0
- data/lib/json-rpc-objects/v11/generic-types.rb +1 -0
- data/lib/json-rpc-objects/v11/wd/error.rb +2 -0
- data/lib/json-rpc-objects/v11/wd/extensions.rb +1 -0
- data/lib/json-rpc-objects/v11/wd/fakes/request.rb +2 -0
- data/lib/json-rpc-objects/v11/wd/fakes/response.rb +2 -0
- data/lib/json-rpc-objects/v11/wd/procedure-call.rb +10 -5
- data/lib/json-rpc-objects/v11/wd/procedure-parameter-description.rb +5 -3
- data/lib/json-rpc-objects/v11/wd/procedure-return.rb +4 -1
- data/lib/json-rpc-objects/v11/wd/request.rb +2 -0
- data/lib/json-rpc-objects/v11/wd/response.rb +2 -0
- data/lib/json-rpc-objects/v11/wd/service-description.rb +8 -5
- data/lib/json-rpc-objects/v11/wd/service-procedure-description.rb +10 -9
- data/lib/json-rpc-objects/v11/wd/tests/test.rb +2 -0
- data/lib/json-rpc-objects/v20/error.rb +2 -0
- data/lib/json-rpc-objects/v20/request.rb +3 -2
- data/lib/json-rpc-objects/v20/response.rb +2 -1
- data/lib/json-rpc-objects/v20/tests/test.rb +2 -0
- data/lib/json-rpc-objects/version.rb +2 -1
- metadata +17 -30
data/CHANGES.txt
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
|
2
|
+
0.3.4 (2011-07-18)
|
3
|
+
* dependency from yajl-ruby to multi_json for compatibility with all
|
4
|
+
other major JSON libraries or unsupported platforms
|
5
|
+
* minor optimizations and corrections
|
6
|
+
* upgrade to modern 'hash-utils' version
|
7
|
+
|
2
8
|
0.3.3 (2011-02-13)
|
3
9
|
* rather big performance lag in generic parsers
|
4
10
|
|
@@ -18,7 +24,8 @@
|
|
18
24
|
* correct error inheritance from 1.1 to 1.0
|
19
25
|
|
20
26
|
0.2.0 (2011-01-30)
|
21
|
-
* high level modules now aren't modules, but constants linking to
|
27
|
+
* high level modules now aren't modules, but constants linking to
|
28
|
+
appropriate classes
|
22
29
|
|
23
30
|
0.1.3 (2011-01-18)
|
24
31
|
* 'version' gem dependency removed
|
data/Gemfile
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
|
-
gem "
|
5
|
-
gem "hash-utils", ">= 0.3.0"
|
6
|
-
gem "types", ">= 0.1.0"
|
4
|
+
gem "hash-utils", ">= 0.18.0"
|
7
5
|
gem "addressable", ">= 2.2.2"
|
8
|
-
gem "
|
6
|
+
gem "abstract", ">= 1.0.0"
|
7
|
+
gem "multi_json", ">= 0"
|
9
8
|
|
10
9
|
# Add dependencies to develop your gem here.
|
11
10
|
# Include everything needed to run rake, tests, features, etc.
|
12
11
|
group :development do
|
13
|
-
gem "bundler", "
|
14
|
-
gem "jeweler", "
|
12
|
+
gem "bundler", ">= 1.0.0"
|
13
|
+
gem "jeweler", ">= 1.5.2"
|
15
14
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,24 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
4
|
+
abstract (1.0.0)
|
5
|
+
addressable (2.2.6)
|
5
6
|
git (1.2.5)
|
6
|
-
hash-utils (0.
|
7
|
-
jeweler (1.
|
8
|
-
bundler (~> 1.0
|
7
|
+
hash-utils (0.18.0)
|
8
|
+
jeweler (1.6.4)
|
9
|
+
bundler (~> 1.0)
|
9
10
|
git (>= 1.2.5)
|
10
11
|
rake
|
11
|
-
|
12
|
-
rake (0.
|
13
|
-
types (0.1.0)
|
14
|
-
multitype-introspection (>= 0.1.0)
|
15
|
-
yajl-ruby (0.7.9)
|
12
|
+
multi_json (1.0.3)
|
13
|
+
rake (0.9.2)
|
16
14
|
|
17
15
|
PLATFORMS
|
18
16
|
ruby
|
19
17
|
|
20
18
|
DEPENDENCIES
|
19
|
+
abstract (>= 1.0.0)
|
21
20
|
addressable (>= 2.2.2)
|
22
|
-
bundler (
|
23
|
-
hash-utils (>= 0.
|
24
|
-
jeweler (
|
25
|
-
|
26
|
-
types (>= 0.1.0)
|
27
|
-
yajl-ruby (>= 0.7.8)
|
21
|
+
bundler (>= 1.0.0)
|
22
|
+
hash-utils (>= 0.18.0)
|
23
|
+
jeweler (>= 1.5.2)
|
24
|
+
multi_json
|
data/LICENSE.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rubygems'
|
3
3
|
require 'bundler'
|
4
|
+
|
4
5
|
begin
|
5
6
|
Bundler.setup(:default, :development)
|
6
7
|
rescue Bundler::BundlerError => e
|
@@ -8,9 +9,10 @@ rescue Bundler::BundlerError => e
|
|
8
9
|
$stderr.puts "Run `bundle install` to install missing gems"
|
9
10
|
exit e.status_code
|
10
11
|
end
|
11
|
-
require 'rake'
|
12
12
|
|
13
|
+
require 'rake'
|
13
14
|
require 'jeweler'
|
15
|
+
|
14
16
|
Jeweler::Tasks.new do |gem|
|
15
17
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
18
|
gem.name = "json-rpc-objects"
|
@@ -25,13 +27,3 @@ Jeweler::Tasks.new do |gem|
|
|
25
27
|
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
28
|
end
|
27
29
|
Jeweler::RubygemsDotOrgTasks.new
|
28
|
-
|
29
|
-
require 'rake/rdoctask'
|
30
|
-
Rake::RDocTask.new do |rdoc|
|
31
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
32
|
-
|
33
|
-
rdoc.rdoc_dir = 'rdoc'
|
34
|
-
rdoc.title = "types #{version}"
|
35
|
-
rdoc.rdoc_files.include('README*')
|
36
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
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.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-
|
11
|
+
s.authors = [%q{Martin Kozák}]
|
12
|
+
s.date = %q{2011-07-18}
|
13
13
|
s.email = %q{martinkozak@martinkozak.net}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -68,39 +68,36 @@ Gem::Specification.new do |s|
|
|
68
68
|
"lib/json-rpc-objects/version.rb"
|
69
69
|
]
|
70
70
|
s.homepage = %q{http://github.com/martinkozak/json-rpc-objects}
|
71
|
-
s.licenses = [
|
72
|
-
s.require_paths = [
|
73
|
-
s.rubygems_version = %q{1.5
|
71
|
+
s.licenses = [%q{MIT}]
|
72
|
+
s.require_paths = [%q{lib}]
|
73
|
+
s.rubygems_version = %q{1.8.5}
|
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
|
77
77
|
s.specification_version = 3
|
78
78
|
|
79
79
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
80
|
-
s.add_runtime_dependency(%q<
|
81
|
-
s.add_runtime_dependency(%q<hash-utils>, [">= 0.3.0"])
|
82
|
-
s.add_runtime_dependency(%q<types>, [">= 0.1.0"])
|
80
|
+
s.add_runtime_dependency(%q<hash-utils>, [">= 0.18.0"])
|
83
81
|
s.add_runtime_dependency(%q<addressable>, [">= 2.2.2"])
|
84
|
-
s.add_runtime_dependency(%q<
|
85
|
-
s.
|
86
|
-
s.add_development_dependency(%q<
|
82
|
+
s.add_runtime_dependency(%q<abstract>, [">= 1.0.0"])
|
83
|
+
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
84
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
85
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
|
87
86
|
else
|
88
|
-
s.add_dependency(%q<
|
89
|
-
s.add_dependency(%q<hash-utils>, [">= 0.3.0"])
|
90
|
-
s.add_dependency(%q<types>, [">= 0.1.0"])
|
87
|
+
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
91
88
|
s.add_dependency(%q<addressable>, [">= 2.2.2"])
|
92
|
-
s.add_dependency(%q<
|
93
|
-
s.add_dependency(%q<
|
94
|
-
s.add_dependency(%q<
|
89
|
+
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
90
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
91
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
92
|
+
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
95
93
|
end
|
96
94
|
else
|
97
|
-
s.add_dependency(%q<
|
98
|
-
s.add_dependency(%q<hash-utils>, [">= 0.3.0"])
|
99
|
-
s.add_dependency(%q<types>, [">= 0.1.0"])
|
95
|
+
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
100
96
|
s.add_dependency(%q<addressable>, [">= 2.2.2"])
|
101
|
-
s.add_dependency(%q<
|
102
|
-
s.add_dependency(%q<
|
103
|
-
s.add_dependency(%q<
|
97
|
+
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
98
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
99
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
100
|
+
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
104
101
|
end
|
105
102
|
end
|
106
103
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
4
|
+
require "hash-utils/hash"
|
5
|
+
require "multi_json"
|
6
|
+
require "abstract"
|
4
7
|
require "json-rpc-objects/version"
|
5
8
|
|
6
9
|
##
|
@@ -30,7 +33,7 @@ module JsonRpcObjects
|
|
30
33
|
#
|
31
34
|
|
32
35
|
def self.create(*args)
|
33
|
-
|
36
|
+
not_implemented
|
34
37
|
end
|
35
38
|
|
36
39
|
##
|
@@ -50,7 +53,7 @@ module JsonRpcObjects
|
|
50
53
|
#
|
51
54
|
|
52
55
|
def self.parse(string)
|
53
|
-
self::new(
|
56
|
+
self::new(MultiJson.decode(string))
|
54
57
|
end
|
55
58
|
|
56
59
|
##
|
@@ -59,7 +62,7 @@ module JsonRpcObjects
|
|
59
62
|
#
|
60
63
|
|
61
64
|
def to_json
|
62
|
-
self.output
|
65
|
+
MultiJson.encode(self.output)
|
63
66
|
end
|
64
67
|
|
65
68
|
##
|
@@ -77,6 +80,7 @@ module JsonRpcObjects
|
|
77
80
|
#
|
78
81
|
|
79
82
|
def check!
|
83
|
+
true
|
80
84
|
end
|
81
85
|
|
82
86
|
##
|
@@ -87,7 +91,7 @@ module JsonRpcObjects
|
|
87
91
|
#
|
88
92
|
|
89
93
|
def output
|
90
|
-
|
94
|
+
not_implemented
|
91
95
|
end
|
92
96
|
|
93
97
|
|
@@ -98,7 +102,7 @@ module JsonRpcObjects
|
|
98
102
|
#
|
99
103
|
|
100
104
|
def data=(value, mode = nil)
|
101
|
-
|
105
|
+
not_implemented
|
102
106
|
end
|
103
107
|
|
104
108
|
##
|
@@ -120,25 +124,6 @@ module JsonRpcObjects
|
|
120
124
|
def normalize!
|
121
125
|
end
|
122
126
|
|
123
|
-
|
124
|
-
private
|
125
|
-
|
126
|
-
##
|
127
|
-
# Raises method is abstract exception.
|
128
|
-
#
|
129
|
-
|
130
|
-
def __abstract
|
131
|
-
self.class::__abstract
|
132
|
-
end
|
133
|
-
|
134
|
-
##
|
135
|
-
# Raises method is abstract exception.
|
136
|
-
#
|
137
|
-
|
138
|
-
def self.__abstract
|
139
|
-
raise Exception::new("Method is abstract.")
|
140
|
-
end
|
141
|
-
|
142
127
|
end
|
143
128
|
end
|
144
129
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "json-rpc-objects/v20/request"
|
3
|
-
require "
|
3
|
+
require "hash-utils/object"
|
4
|
+
require "multi_json"
|
4
5
|
|
5
6
|
##
|
6
7
|
# Main JSON-RPC Objects module.
|
@@ -45,9 +46,9 @@ module JsonRpcObjects
|
|
45
46
|
#
|
46
47
|
|
47
48
|
def self.parse(string, default_v11 = :wd)
|
48
|
-
data =
|
49
|
+
data = MultiJson.decode(string)
|
49
50
|
|
50
|
-
if not data.
|
51
|
+
if not data.hash?
|
51
52
|
raise Exception::new("Data in JSON string aren't object.")
|
52
53
|
end
|
53
54
|
|
@@ -71,7 +72,7 @@ module JsonRpcObjects
|
|
71
72
|
end
|
72
73
|
|
73
74
|
# Returns
|
74
|
-
if not
|
75
|
+
if not file.in? @@files
|
75
76
|
require file
|
76
77
|
@@files[file] = true
|
77
78
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "json-rpc-objects/v20/response"
|
3
|
+
require "hash-utils/object"
|
4
|
+
require "multi_json"
|
3
5
|
|
4
6
|
##
|
5
7
|
# Main JSON-RPC Objects module.
|
@@ -43,9 +45,9 @@ module JsonRpcObjects
|
|
43
45
|
#
|
44
46
|
|
45
47
|
def self.parse(string, default_v11 = :wd)
|
46
|
-
data =
|
48
|
+
data = MultiJson.decode(string)
|
47
49
|
|
48
|
-
if not data.
|
50
|
+
if not data.hash?
|
49
51
|
raise Exception::new("Data in JSON string aren't object.")
|
50
52
|
end
|
51
53
|
|
@@ -69,7 +71,7 @@ module JsonRpcObjects
|
|
69
71
|
end
|
70
72
|
|
71
73
|
# Returns
|
72
|
-
if not
|
74
|
+
if not file.in? @@files
|
73
75
|
require file
|
74
76
|
@@files[file] = true
|
75
77
|
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
2
4
|
require "json-rpc-objects/generic/request"
|
5
|
+
require "hash-utils/object"
|
3
6
|
|
4
7
|
##
|
5
8
|
# Main JSON-RPC Objects module.
|
@@ -131,7 +134,7 @@ module JsonRpcObjects
|
|
131
134
|
#
|
132
135
|
|
133
136
|
def __check_method
|
134
|
-
if not @method.
|
137
|
+
if not @method.symbol?
|
135
138
|
raise Exception::new("Service name must be Symbol or convertable to Symbol.")
|
136
139
|
end
|
137
140
|
end
|
@@ -141,7 +144,7 @@ module JsonRpcObjects
|
|
141
144
|
#
|
142
145
|
|
143
146
|
def __check_params
|
144
|
-
if not @params.
|
147
|
+
if not @params.array?
|
145
148
|
raise Exception::new("Params must be Array.")
|
146
149
|
end
|
147
150
|
end
|
@@ -151,7 +154,7 @@ module JsonRpcObjects
|
|
151
154
|
#
|
152
155
|
|
153
156
|
def __normalize_method
|
154
|
-
if @method.
|
157
|
+
if @method.string?
|
155
158
|
@method = @method.to_sym
|
156
159
|
end
|
157
160
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
2
4
|
require "hash-utils/hash"
|
3
5
|
require "json-rpc-objects/v11/wd/request"
|
4
6
|
|
@@ -58,7 +60,7 @@ module JsonRpcObjects
|
|
58
60
|
# property.
|
59
61
|
if data.include? :kwparams
|
60
62
|
@keyword_params = data[:kwparams]
|
61
|
-
@keyword_params.
|
63
|
+
@keyword_params.keys_to_sym!
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
2
4
|
require "hash-utils/array"
|
5
|
+
require "hash-utils/object"
|
3
6
|
require "json-rpc-objects/v11/alt/procedure-parameter-description"
|
4
7
|
require "json-rpc-objects/v11/wd/service-procedure-description"
|
5
8
|
|
@@ -47,7 +50,7 @@ module JsonRpcObjects
|
|
47
50
|
def check!
|
48
51
|
super()
|
49
52
|
|
50
|
-
if
|
53
|
+
if @params.array? and (not @params.all? { |v| v.type != JsonRpcObjects::V11::GenericTypes::Nil })
|
51
54
|
raise Exception::new("Nil return type isn't allowed for parameters.")
|
52
55
|
end
|
53
56
|
end
|
@@ -1,5 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
4
|
+
require "hash-utils/array"
|
2
5
|
require "hash-utils/hash"
|
6
|
+
require "hash-utils/object"
|
7
|
+
require "hash-utils/string"
|
3
8
|
require "json-rpc-objects/v10/request"
|
4
9
|
require "json-rpc-objects/v11/wd/extensions"
|
5
10
|
|
@@ -63,7 +68,7 @@ module JsonRpcObjects
|
|
63
68
|
def check!
|
64
69
|
super()
|
65
70
|
|
66
|
-
if not @keyword_params.nil? and not @keyword_params.
|
71
|
+
if not @keyword_params.nil? and not @keyword_params.hash?
|
67
72
|
raise Exception::new("Keyword params must be Hash.")
|
68
73
|
end
|
69
74
|
end
|
@@ -142,15 +147,15 @@ module JsonRpcObjects
|
|
142
147
|
# If named arguments used, assigns keys as symbols
|
143
148
|
# but keeps numeric arguments as integers
|
144
149
|
|
145
|
-
if @params.
|
150
|
+
if @params.hash?
|
146
151
|
@params = @params.dup
|
147
152
|
@keyword_params = @params.remove! { |k, v| not k.numeric? }
|
148
|
-
@params = @params.sort_by { |i| i
|
153
|
+
@params = @params.sort_by { |i| i.first.to_i }.map { |i| i.second }
|
149
154
|
else
|
150
155
|
@keyword_params = { }
|
151
156
|
end
|
152
157
|
|
153
|
-
@keyword_params.
|
158
|
+
@keyword_params.keys_to_sym!
|
154
159
|
|
155
160
|
end
|
156
161
|
|
@@ -178,7 +183,7 @@ module JsonRpcObjects
|
|
178
183
|
#
|
179
184
|
|
180
185
|
def __check_params
|
181
|
-
if not @params.nil? and not @params.
|
186
|
+
if not @params.nil? and not @params.array?
|
182
187
|
raise Exception::new("Params must be Array.")
|
183
188
|
end
|
184
189
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
3
4
|
require "json-rpc-objects/v11/generic-types"
|
4
5
|
require "json-rpc-objects/generic"
|
6
|
+
require "hash-utils/object"
|
5
7
|
|
6
8
|
##
|
7
9
|
# Main JSON-RPC Objects module.
|
@@ -98,7 +100,7 @@ module JsonRpcObjects
|
|
98
100
|
def check!
|
99
101
|
self.normalize!
|
100
102
|
|
101
|
-
if not @name.
|
103
|
+
if not @name.symbol?
|
102
104
|
raise Exception::new("Parameter name must be Symbol or convertable to Symbol.")
|
103
105
|
end
|
104
106
|
|
@@ -142,7 +144,7 @@ module JsonRpcObjects
|
|
142
144
|
#
|
143
145
|
|
144
146
|
def normalize!
|
145
|
-
if @name.
|
147
|
+
if @name.string?
|
146
148
|
@name = @name.to_sym
|
147
149
|
end
|
148
150
|
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
2
4
|
require "json-rpc-objects/v10/response"
|
3
5
|
require "json-rpc-objects/v11/wd/error"
|
4
6
|
require "json-rpc-objects/v11/wd/extensions"
|
7
|
+
require "hash-utils/object"
|
5
8
|
|
6
9
|
##
|
7
10
|
# Main JSON-RPC Objects module.
|
@@ -128,7 +131,7 @@ module JsonRpcObjects
|
|
128
131
|
#
|
129
132
|
|
130
133
|
def __create_error
|
131
|
-
if @error.
|
134
|
+
if @error.hash?
|
132
135
|
@error = self.class::ERROR_CLASS::new(@error)
|
133
136
|
end
|
134
137
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
2
4
|
require "addressable/uri"
|
3
5
|
require "json-rpc-objects/v11/wd/service-procedure-description"
|
4
6
|
require "json-rpc-objects/generic"
|
5
7
|
require "hash-utils/array"
|
8
|
+
require "hash-utils/object"
|
6
9
|
|
7
10
|
##
|
8
11
|
# Main JSON-RPC Objects module.
|
@@ -130,7 +133,7 @@ module JsonRpcObjects
|
|
130
133
|
def check!
|
131
134
|
self.normalize!
|
132
135
|
|
133
|
-
if not @name.
|
136
|
+
if not @name.symbol?
|
134
137
|
raise Exception::new("Service name must be Symbol or convertable to Symbol.")
|
135
138
|
end
|
136
139
|
|
@@ -139,11 +142,11 @@ module JsonRpcObjects
|
|
139
142
|
end
|
140
143
|
|
141
144
|
if (not @procs.nil?)
|
142
|
-
if (not @procs.
|
145
|
+
if (not @procs.array?) or (not @procs.all? { |v| v.kind_of? self.class::PROCEDURE_DESCRIPTION_CLASS })
|
143
146
|
raise Exception::new("If procs is defined, must be an Array of " << self.class::PROCEDURE_DESCRIPTION_CLASS.name << " objects.")
|
144
147
|
end
|
145
148
|
|
146
|
-
if @procs.
|
149
|
+
if @procs.array?
|
147
150
|
@procs.each { |proc| proc.check! }
|
148
151
|
end
|
149
152
|
end
|
@@ -222,7 +225,7 @@ module JsonRpcObjects
|
|
222
225
|
@address = data[:address]
|
223
226
|
@procs = data[:procs]
|
224
227
|
|
225
|
-
if @procs.
|
228
|
+
if @procs.array?
|
226
229
|
@procs = @procs.map { |v| self.class::PROCEDURE_DESCRIPTION_CLASS::new(v) }
|
227
230
|
end
|
228
231
|
end
|
@@ -232,7 +235,7 @@ module JsonRpcObjects
|
|
232
235
|
#
|
233
236
|
|
234
237
|
def normalize!
|
235
|
-
if @name.
|
238
|
+
if @name.string?
|
236
239
|
@name = @name.to_sym
|
237
240
|
end
|
238
241
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
2
4
|
require "addressable/uri"
|
3
|
-
require "multitype-introspection"
|
4
|
-
require "types"
|
5
5
|
require "hash-utils/array"
|
6
|
+
require "hash-utils/object"
|
6
7
|
require "json-rpc-objects/v11/wd/procedure-parameter-description"
|
7
8
|
require "json-rpc-objects/generic"
|
8
9
|
|
@@ -112,16 +113,16 @@ module JsonRpcObjects
|
|
112
113
|
def check!
|
113
114
|
self.normalize!
|
114
115
|
|
115
|
-
if not @name.
|
116
|
+
if not @name.symbol?
|
116
117
|
raise Exception::new("Procedure name must be Symbol or convertable to Symbol.")
|
117
118
|
end
|
118
119
|
|
119
120
|
if not @params.nil?
|
120
|
-
if (not @params.
|
121
|
+
if (not @params.array?) or (not @params.all? { |v| v.kind_of? self.class::PARAMETER_DESCRIPTION_CLASS })
|
121
122
|
raise Exception::new("If params is defined, must be an Array of " << self.class::PARAMETER_DESCRIPTION_CLASS.name << " objects.")
|
122
123
|
end
|
123
124
|
|
124
|
-
if @params.
|
125
|
+
if @params.array?
|
125
126
|
@params.each { |param| param.check! }
|
126
127
|
end
|
127
128
|
end
|
@@ -134,7 +135,7 @@ module JsonRpcObjects
|
|
134
135
|
@return.check!
|
135
136
|
end
|
136
137
|
|
137
|
-
if (not @idempotent.nil?) and (not @idempotent.
|
138
|
+
if (not @idempotent.nil?) and (not @idempotent.boolean?)
|
138
139
|
raise Exception::new("If idempotent is defined, must be boolean.")
|
139
140
|
end
|
140
141
|
end
|
@@ -207,11 +208,11 @@ module JsonRpcObjects
|
|
207
208
|
@params = data[:params]
|
208
209
|
@return = data[:return]
|
209
210
|
|
210
|
-
if @params.
|
211
|
+
if @params.array?
|
211
212
|
@params = @params.map { |v| self.class::PARAMETER_DESCRIPTION_CLASS::new(v) }
|
212
213
|
end
|
213
214
|
|
214
|
-
if @return.
|
215
|
+
if @return.hash?
|
215
216
|
@return = self.class::PARAMETER_DESCRIPTION_CLASS::new(@return)
|
216
217
|
end
|
217
218
|
end
|
@@ -221,7 +222,7 @@ module JsonRpcObjects
|
|
221
222
|
#
|
222
223
|
|
223
224
|
def normalize!
|
224
|
-
if @name.
|
225
|
+
if @name.string?
|
225
226
|
@name = @name.to_sym
|
226
227
|
end
|
227
228
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
2
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
3
4
|
require "hash-utils/hash"
|
4
5
|
require "json-rpc-objects/v11/alt/request"
|
5
6
|
|
@@ -104,7 +105,7 @@ module JsonRpcObjects
|
|
104
105
|
#
|
105
106
|
|
106
107
|
def __get_params(data)
|
107
|
-
if @params.
|
108
|
+
if @params.hash?
|
108
109
|
@keyword_params = @params.keys_to_sym
|
109
110
|
@params = nil
|
110
111
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require "hash-utils/object"
|
2
3
|
|
3
4
|
##
|
4
5
|
# Main JSON-RPC Objects module.
|
@@ -50,7 +51,7 @@ module JsonRpcObjects
|
|
50
51
|
#
|
51
52
|
|
52
53
|
def self.get(mod)
|
53
|
-
if not
|
54
|
+
if not mod.in? @@cache
|
54
55
|
@@cache[mod] = self::new(mod)
|
55
56
|
end
|
56
57
|
|
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.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Martin Koz\xC3\xA1k"
|
@@ -10,86 +10,74 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-07-18 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
16
|
+
name: hash-utils
|
18
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
18
|
none: false
|
20
19
|
requirements:
|
21
20
|
- - ">="
|
22
21
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
22
|
+
version: 0.18.0
|
24
23
|
type: :runtime
|
25
24
|
prerelease: false
|
26
25
|
version_requirements: *id001
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
27
|
+
name: addressable
|
29
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
29
|
none: false
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
33
|
+
version: 2.2.2
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: *id002
|
38
37
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
38
|
+
name: abstract
|
40
39
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
42
|
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
44
|
+
version: 1.0.0
|
46
45
|
type: :runtime
|
47
46
|
prerelease: false
|
48
47
|
version_requirements: *id003
|
49
48
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
49
|
+
name: multi_json
|
51
50
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
51
|
none: false
|
53
52
|
requirements:
|
54
53
|
- - ">="
|
55
54
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
55
|
+
version: "0"
|
57
56
|
type: :runtime
|
58
57
|
prerelease: false
|
59
58
|
version_requirements: *id004
|
60
59
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
60
|
+
name: bundler
|
62
61
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
62
|
none: false
|
64
63
|
requirements:
|
65
64
|
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 0.7.8
|
68
|
-
type: :runtime
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: bundler
|
73
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ~>
|
77
65
|
- !ruby/object:Gem::Version
|
78
66
|
version: 1.0.0
|
79
67
|
type: :development
|
80
68
|
prerelease: false
|
81
|
-
version_requirements: *
|
69
|
+
version_requirements: *id005
|
82
70
|
- !ruby/object:Gem::Dependency
|
83
71
|
name: jeweler
|
84
|
-
requirement: &
|
72
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
85
73
|
none: false
|
86
74
|
requirements:
|
87
|
-
- -
|
75
|
+
- - ">="
|
88
76
|
- !ruby/object:Gem::Version
|
89
77
|
version: 1.5.2
|
90
78
|
type: :development
|
91
79
|
prerelease: false
|
92
|
-
version_requirements: *
|
80
|
+
version_requirements: *id006
|
93
81
|
description:
|
94
82
|
email: martinkozak@martinkozak.net
|
95
83
|
executables: []
|
@@ -150,7 +138,6 @@ files:
|
|
150
138
|
- lib/json-rpc-objects/v20/response.rb
|
151
139
|
- lib/json-rpc-objects/v20/tests/test.rb
|
152
140
|
- lib/json-rpc-objects/version.rb
|
153
|
-
has_rdoc: true
|
154
141
|
homepage: http://github.com/martinkozak/json-rpc-objects
|
155
142
|
licenses:
|
156
143
|
- MIT
|
@@ -164,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
151
|
requirements:
|
165
152
|
- - ">="
|
166
153
|
- !ruby/object:Gem::Version
|
167
|
-
hash:
|
154
|
+
hash: -1516690560256011752
|
168
155
|
segments:
|
169
156
|
- 0
|
170
157
|
version: "0"
|
@@ -177,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
164
|
requirements: []
|
178
165
|
|
179
166
|
rubyforge_project:
|
180
|
-
rubygems_version: 1.5
|
167
|
+
rubygems_version: 1.8.5
|
181
168
|
signing_key:
|
182
169
|
specification_version: 3
|
183
170
|
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.
|