json-rpc-objects 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +5 -0
- data/Gemfile.lock +11 -5
- data/LICENSE.txt +1 -1
- data/VERSION +1 -1
- data/json-rpc-objects.gemspec +4 -3
- data/lib/json-rpc-objects/serializer/none.rb +55 -0
- data/lib/json-rpc-objects/v10/request.rb +1 -1
- data/lib/json-rpc-objects/v20/tests/test.rb +6 -6
- metadata +55 -24
data/CHANGES.txt
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,17 +2,23 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
abstract (1.0.0)
|
5
|
-
addressable (2.
|
5
|
+
addressable (2.3.4)
|
6
6
|
git (1.2.5)
|
7
|
-
hash-utils (
|
8
|
-
|
7
|
+
hash-utils (2.1.1)
|
8
|
+
ruby-version (>= 0.4.0)
|
9
|
+
jeweler (1.8.4)
|
9
10
|
bundler (~> 1.0)
|
10
11
|
git (>= 1.2.5)
|
11
12
|
rake
|
13
|
+
rdoc
|
14
|
+
json (1.7.7)
|
12
15
|
json-rpc-objects-json (0.1.1)
|
13
16
|
multi_json
|
14
|
-
multi_json (1.
|
15
|
-
rake (0.
|
17
|
+
multi_json (1.7.2)
|
18
|
+
rake (10.0.4)
|
19
|
+
rdoc (4.0.1)
|
20
|
+
json (~> 1.4)
|
21
|
+
ruby-version (0.4.3)
|
16
22
|
|
17
23
|
PLATFORMS
|
18
24
|
ruby
|
data/LICENSE.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/json-rpc-objects.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "json-rpc-objects"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.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\u{e1}k"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-05-06"
|
13
13
|
s.email = "martinkozak@martinkozak.net"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/json-rpc-objects/response.rb",
|
36
36
|
"lib/json-rpc-objects/serializer.rb",
|
37
37
|
"lib/json-rpc-objects/serializer/marshal.rb",
|
38
|
+
"lib/json-rpc-objects/serializer/none.rb",
|
38
39
|
"lib/json-rpc-objects/v10/error.rb",
|
39
40
|
"lib/json-rpc-objects/v10/request.rb",
|
40
41
|
"lib/json-rpc-objects/v10/response.rb",
|
@@ -72,7 +73,7 @@ Gem::Specification.new do |s|
|
|
72
73
|
s.homepage = "http://github.com/martinkozak/json-rpc-objects"
|
73
74
|
s.licenses = ["MIT"]
|
74
75
|
s.require_paths = ["lib"]
|
75
|
-
s.rubygems_version = "1.8.
|
76
|
+
s.rubygems_version = "1.8.23"
|
76
77
|
s.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."
|
77
78
|
|
78
79
|
if s.respond_to? :specification_version then
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# (c) 2012 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
+
|
4
|
+
require "json-rpc-objects/serializer"
|
5
|
+
|
6
|
+
##
|
7
|
+
# Main JSON-RPC Objects module.
|
8
|
+
#
|
9
|
+
|
10
|
+
module JsonRpcObjects
|
11
|
+
|
12
|
+
##
|
13
|
+
# Abstract serializer class.
|
14
|
+
#
|
15
|
+
# @since 0.4.0
|
16
|
+
# @abstract
|
17
|
+
#
|
18
|
+
|
19
|
+
class Serializer
|
20
|
+
|
21
|
+
##
|
22
|
+
# +None+ serializer which doesn't serialize at all.
|
23
|
+
# @since 0.4.3
|
24
|
+
#
|
25
|
+
|
26
|
+
class None < Serializer
|
27
|
+
|
28
|
+
##
|
29
|
+
# Serializes data.
|
30
|
+
#
|
31
|
+
# @param [Object] data some data
|
32
|
+
# @return [Object] object in serialized form
|
33
|
+
#
|
34
|
+
|
35
|
+
def serialize(data)
|
36
|
+
data
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Deserializes data.
|
41
|
+
#
|
42
|
+
# @param [Object] data data in serialized form
|
43
|
+
# @return [Object] deserialized data
|
44
|
+
#
|
45
|
+
|
46
|
+
def deserialize(data)
|
47
|
+
data
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
@@ -7,12 +7,6 @@ $:.push("../../..")
|
|
7
7
|
#JsonRpcObjects::default_serializer(JsonRpcObjects::Serializer::Marshal)
|
8
8
|
|
9
9
|
|
10
|
-
require "../request"
|
11
|
-
req = JsonRpcObjects::V20::Request::create(:alfa, {:alfa => :beta}, :id => :"12345", :"$whatever" => false)
|
12
|
-
puts req.serialize
|
13
|
-
req = JsonRpcObjects::V20::Request::create(:alfa, [:beta], :"version" => :"1.0")
|
14
|
-
puts req.serialize
|
15
|
-
|
16
10
|
require "../error"
|
17
11
|
err = JsonRpcObjects::V20::Error::create(200, "some problem", :data => "Additional data.")
|
18
12
|
|
@@ -22,6 +16,12 @@ puts res.serialize
|
|
22
16
|
res = JsonRpcObjects::V20::Response::create(true, nil, :id => 12345)
|
23
17
|
puts res.serialize
|
24
18
|
|
19
|
+
require "../request"
|
20
|
+
req = JsonRpcObjects::V20::Request::create(:alfa, [:beta], :"version" => :"1.0")
|
21
|
+
puts req.serialize
|
22
|
+
req = JsonRpcObjects::V20::Request::create(:alfa, {:alfa => :beta}, :id => :"12345", :"$whatever" => false)
|
23
|
+
puts req.serialize
|
24
|
+
|
25
25
|
require "../../request"
|
26
26
|
puts JsonRpcObjects::Request::parse(req.serialize).inspect
|
27
27
|
require "../../response"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-rpc-objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,74 +9,104 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hash-utils
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 0.18.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.18.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: addressable
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
|
-
- -
|
35
|
+
- - '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
37
|
version: 2.2.2
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.2.2
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: abstract
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
|
-
- -
|
51
|
+
- - '>='
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: 1.0.0
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: json-rpc-objects-json
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
|
-
- -
|
67
|
+
- - '>='
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: 0.1.1
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.1.1
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: bundler
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
|
-
- -
|
83
|
+
- - '>='
|
64
84
|
- !ruby/object:Gem::Version
|
65
85
|
version: 1.0.0
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.0.0
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: jeweler
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
|
-
- -
|
99
|
+
- - '>='
|
75
100
|
- !ruby/object:Gem::Version
|
76
101
|
version: 1.5.2
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.5.2
|
80
110
|
description:
|
81
111
|
email: martinkozak@martinkozak.net
|
82
112
|
executables: []
|
@@ -104,6 +134,7 @@ files:
|
|
104
134
|
- lib/json-rpc-objects/response.rb
|
105
135
|
- lib/json-rpc-objects/serializer.rb
|
106
136
|
- lib/json-rpc-objects/serializer/marshal.rb
|
137
|
+
- lib/json-rpc-objects/serializer/none.rb
|
107
138
|
- lib/json-rpc-objects/v10/error.rb
|
108
139
|
- lib/json-rpc-objects/v10/request.rb
|
109
140
|
- lib/json-rpc-objects/v10/response.rb
|
@@ -147,21 +178,21 @@ require_paths:
|
|
147
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
179
|
none: false
|
149
180
|
requirements:
|
150
|
-
- -
|
181
|
+
- - '>='
|
151
182
|
- !ruby/object:Gem::Version
|
152
183
|
version: '0'
|
153
184
|
segments:
|
154
185
|
- 0
|
155
|
-
hash: -
|
186
|
+
hash: -4582882999797080532
|
156
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
188
|
none: false
|
158
189
|
requirements:
|
159
|
-
- -
|
190
|
+
- - '>='
|
160
191
|
- !ruby/object:Gem::Version
|
161
192
|
version: '0'
|
162
193
|
requirements: []
|
163
194
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.8.
|
195
|
+
rubygems_version: 1.8.23
|
165
196
|
signing_key:
|
166
197
|
specification_version: 3
|
167
198
|
summary: Implementation of JSON-RPC objects with respect to specifications compliance
|