json-rpc-objects 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +3 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -2
- data/README.md +22 -3
- data/VERSION +1 -1
- data/json-rpc-objects.gemspec +13 -15
- data/lib/json-rpc-objects/v20/tests/test.rb +2 -2
- metadata +66 -71
- data/lib/json-rpc-objects/serializer/json.rb +0 -56
- data/lib/json-rpc-objects/serializer/yaml.rb +0 -56
data/CHANGES.txt
CHANGED
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ source "http://rubygems.org"
|
|
4
4
|
gem "hash-utils", ">= 0.18.0"
|
5
5
|
gem "addressable", ">= 2.2.2"
|
6
6
|
gem "abstract", ">= 1.0.0"
|
7
|
-
gem "
|
7
|
+
gem "json-rpc-objects-json", ">= 0.1.1"
|
8
8
|
|
9
9
|
# Add dependencies to develop your gem here.
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
data/Gemfile.lock
CHANGED
@@ -4,11 +4,13 @@ GEM
|
|
4
4
|
abstract (1.0.0)
|
5
5
|
addressable (2.2.6)
|
6
6
|
git (1.2.5)
|
7
|
-
hash-utils (0.18.
|
7
|
+
hash-utils (0.18.1)
|
8
8
|
jeweler (1.6.4)
|
9
9
|
bundler (~> 1.0)
|
10
10
|
git (>= 1.2.5)
|
11
11
|
rake
|
12
|
+
json-rpc-objects-json (0.1.1)
|
13
|
+
multi_json
|
12
14
|
multi_json (1.0.3)
|
13
15
|
rake (0.9.2)
|
14
16
|
|
@@ -21,4 +23,4 @@ DEPENDENCIES
|
|
21
23
|
bundler (>= 1.0.0)
|
22
24
|
hash-utils (>= 0.18.0)
|
23
25
|
jeweler (>= 1.5.2)
|
24
|
-
|
26
|
+
json-rpc-objects-json (>= 0.1.1)
|
data/README.md
CHANGED
@@ -92,9 +92,18 @@ the protocol version using `#VERSION` class constant.
|
|
92
92
|
### Serializers
|
93
93
|
|
94
94
|
Multiple serializers support is implemented, so you aren't limited to
|
95
|
-
JSON[8] only, but you can use also built-in
|
96
|
-
[Ruby marshaling][10] format
|
97
|
-
|
95
|
+
JSON[8] only, but you can use also built-in serializer to
|
96
|
+
[Ruby marshaling][10] format or serializers to [YAML][9], [BSON][11]
|
97
|
+
and others. At this time, the following serializer gems are available:
|
98
|
+
|
99
|
+
* [json-rpc-objects-json][20] – JSON using the [multi_json][12] gem for
|
100
|
+
widespread compatibility,
|
101
|
+
* [json-rpc-objects-yaml][21] – [YAML][9] using the standard library
|
102
|
+
[Ruby Syck][13],
|
103
|
+
* [json-rpc-objects-bson][22] – [BSON][11] format of MongoDB,
|
104
|
+
* [json-rpc-objects-msgpack][23] – very fast [MessagePack][14] format,
|
105
|
+
* [json-rpc-objects-psych][24] – [YAML][9] using more modern
|
106
|
+
[libyaml][15] library.
|
98
107
|
|
99
108
|
You can set the default serializer for whole library session (both class
|
100
109
|
and instance of the class are supported):
|
@@ -146,3 +155,13 @@ further details.
|
|
146
155
|
[9]: http://www.yaml.org/
|
147
156
|
[10]: http://ruby-doc.org/core/classes/Marshal.html
|
148
157
|
[11]: http://bsonspec.org/
|
158
|
+
[12]: http://github.com/intridea/multi_json
|
159
|
+
[13]: http://www.ruby-doc.org/stdlib/libdoc/syck/rdoc/index.html
|
160
|
+
[14]: http://msgpack.org/
|
161
|
+
[15]: http://pyyaml.org/wiki/LibYAML
|
162
|
+
|
163
|
+
[20]: https://github.com/martinkozak/json-rpc-objects-json
|
164
|
+
[21]: https://github.com/martinkozak/json-rpc-objects-yaml
|
165
|
+
[22]: https://github.com/martinkozak/json-rpc-objects-bson
|
166
|
+
[23]: https://github.com/martinkozak/json-rpc-objects-msgpack
|
167
|
+
[24]: https://github.com/martinkozak/json-rpc-objects-psych
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/json-rpc-objects.gemspec
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.4.
|
7
|
+
s.name = "json-rpc-objects"
|
8
|
+
s.version = "0.4.2"
|
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 =
|
13
|
-
s.email =
|
11
|
+
s.authors = ["Martin Koz\u{e1}k"]
|
12
|
+
s.date = "2011-08-28"
|
13
|
+
s.email = "martinkozak@martinkozak.net"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
16
16
|
"README.md"
|
@@ -34,9 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/json-rpc-objects/request.rb",
|
35
35
|
"lib/json-rpc-objects/response.rb",
|
36
36
|
"lib/json-rpc-objects/serializer.rb",
|
37
|
-
"lib/json-rpc-objects/serializer/json.rb",
|
38
37
|
"lib/json-rpc-objects/serializer/marshal.rb",
|
39
|
-
"lib/json-rpc-objects/serializer/yaml.rb",
|
40
38
|
"lib/json-rpc-objects/v10/error.rb",
|
41
39
|
"lib/json-rpc-objects/v10/request.rb",
|
42
40
|
"lib/json-rpc-objects/v10/response.rb",
|
@@ -71,11 +69,11 @@ Gem::Specification.new do |s|
|
|
71
69
|
"lib/json-rpc-objects/v20/tests/test.rb",
|
72
70
|
"lib/json-rpc-objects/version.rb"
|
73
71
|
]
|
74
|
-
s.homepage =
|
75
|
-
s.licenses = [
|
76
|
-
s.require_paths = [
|
77
|
-
s.rubygems_version =
|
78
|
-
s.summary =
|
72
|
+
s.homepage = "http://github.com/martinkozak/json-rpc-objects"
|
73
|
+
s.licenses = ["MIT"]
|
74
|
+
s.require_paths = ["lib"]
|
75
|
+
s.rubygems_version = "1.8.10"
|
76
|
+
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."
|
79
77
|
|
80
78
|
if s.respond_to? :specification_version then
|
81
79
|
s.specification_version = 3
|
@@ -84,14 +82,14 @@ Gem::Specification.new do |s|
|
|
84
82
|
s.add_runtime_dependency(%q<hash-utils>, [">= 0.18.0"])
|
85
83
|
s.add_runtime_dependency(%q<addressable>, [">= 2.2.2"])
|
86
84
|
s.add_runtime_dependency(%q<abstract>, [">= 1.0.0"])
|
87
|
-
s.add_runtime_dependency(%q<
|
85
|
+
s.add_runtime_dependency(%q<json-rpc-objects-json>, [">= 0.1.1"])
|
88
86
|
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
89
87
|
s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
|
90
88
|
else
|
91
89
|
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
92
90
|
s.add_dependency(%q<addressable>, [">= 2.2.2"])
|
93
91
|
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
94
|
-
s.add_dependency(%q<
|
92
|
+
s.add_dependency(%q<json-rpc-objects-json>, [">= 0.1.1"])
|
95
93
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
96
94
|
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
97
95
|
end
|
@@ -99,7 +97,7 @@ Gem::Specification.new do |s|
|
|
99
97
|
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
100
98
|
s.add_dependency(%q<addressable>, [">= 2.2.2"])
|
101
99
|
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
102
|
-
s.add_dependency(%q<
|
100
|
+
s.add_dependency(%q<json-rpc-objects-json>, [">= 0.1.1"])
|
103
101
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
104
102
|
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
105
103
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
$:.push("../../..")
|
5
5
|
|
6
|
-
require "json-rpc-objects/serializer/marshal"
|
7
|
-
JsonRpcObjects::default_serializer(JsonRpcObjects::Serializer::Marshal)
|
6
|
+
#require "json-rpc-objects/serializer/marshal"
|
7
|
+
#JsonRpcObjects::default_serializer(JsonRpcObjects::Serializer::Marshal)
|
8
8
|
|
9
9
|
|
10
10
|
require "../request"
|
metadata
CHANGED
@@ -1,93 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-rpc-objects
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.4.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
7
|
+
authors:
|
8
|
+
- Martin Kozák
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: hash-utils
|
17
|
-
requirement: &
|
16
|
+
requirement: &10215320 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
22
21
|
version: 0.18.0
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *10215320
|
25
|
+
- !ruby/object:Gem::Dependency
|
27
26
|
name: addressable
|
28
|
-
requirement: &
|
27
|
+
requirement: &10214700 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
33
32
|
version: 2.2.2
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *10214700
|
36
|
+
- !ruby/object:Gem::Dependency
|
38
37
|
name: abstract
|
39
|
-
requirement: &
|
38
|
+
requirement: &10214160 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
44
43
|
version: 1.0.0
|
45
44
|
type: :runtime
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
-
requirement: &
|
46
|
+
version_requirements: *10214160
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: json-rpc-objects-json
|
49
|
+
requirement: &10213240 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.1
|
56
55
|
type: :runtime
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *10213240
|
58
|
+
- !ruby/object:Gem::Dependency
|
60
59
|
name: bundler
|
61
|
-
requirement: &
|
60
|
+
requirement: &10212320 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
66
65
|
version: 1.0.0
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
70
|
-
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: *10212320
|
69
|
+
- !ruby/object:Gem::Dependency
|
71
70
|
name: jeweler
|
72
|
-
requirement: &
|
71
|
+
requirement: &10211580 !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
77
76
|
version: 1.5.2
|
78
77
|
type: :development
|
79
78
|
prerelease: false
|
80
|
-
version_requirements: *
|
79
|
+
version_requirements: *10211580
|
81
80
|
description:
|
82
81
|
email: martinkozak@martinkozak.net
|
83
82
|
executables: []
|
84
|
-
|
85
83
|
extensions: []
|
86
|
-
|
87
|
-
extra_rdoc_files:
|
84
|
+
extra_rdoc_files:
|
88
85
|
- LICENSE.txt
|
89
86
|
- README.md
|
90
|
-
files:
|
87
|
+
files:
|
91
88
|
- .document
|
92
89
|
- CHANGES.txt
|
93
90
|
- Gemfile
|
@@ -106,9 +103,7 @@ files:
|
|
106
103
|
- lib/json-rpc-objects/request.rb
|
107
104
|
- lib/json-rpc-objects/response.rb
|
108
105
|
- lib/json-rpc-objects/serializer.rb
|
109
|
-
- lib/json-rpc-objects/serializer/json.rb
|
110
106
|
- lib/json-rpc-objects/serializer/marshal.rb
|
111
|
-
- lib/json-rpc-objects/serializer/yaml.rb
|
112
107
|
- lib/json-rpc-objects/v10/error.rb
|
113
108
|
- lib/json-rpc-objects/v10/request.rb
|
114
109
|
- lib/json-rpc-objects/v10/response.rb
|
@@ -143,34 +138,34 @@ files:
|
|
143
138
|
- lib/json-rpc-objects/v20/tests/test.rb
|
144
139
|
- lib/json-rpc-objects/version.rb
|
145
140
|
homepage: http://github.com/martinkozak/json-rpc-objects
|
146
|
-
licenses:
|
141
|
+
licenses:
|
147
142
|
- MIT
|
148
143
|
post_install_message:
|
149
144
|
rdoc_options: []
|
150
|
-
|
151
|
-
require_paths:
|
145
|
+
require_paths:
|
152
146
|
- lib
|
153
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
148
|
none: false
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
|
159
|
-
segments:
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
segments:
|
160
154
|
- 0
|
161
|
-
|
162
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
hash: -3740843139773284063
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
157
|
none: false
|
164
|
-
requirements:
|
165
|
-
- -
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version:
|
158
|
+
requirements:
|
159
|
+
- - ! '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
168
162
|
requirements: []
|
169
|
-
|
170
163
|
rubyforge_project:
|
171
|
-
rubygems_version: 1.8.
|
164
|
+
rubygems_version: 1.8.10
|
172
165
|
signing_key:
|
173
166
|
specification_version: 3
|
174
|
-
summary: Implementation of JSON-RPC objects with respect to specifications compliance
|
167
|
+
summary: Implementation of JSON-RPC objects with respect to specifications compliance
|
168
|
+
and API backward compatibility. Implements all versions of the protocol and support
|
169
|
+
for ability to communicate by the same protocol version which other side uses by
|
170
|
+
a transparent way.
|
175
171
|
test_files: []
|
176
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
-
|
4
|
-
require "json-rpc-objects/serializer"
|
5
|
-
require "multi_json"
|
6
|
-
|
7
|
-
##
|
8
|
-
# Main JSON-RPC Objects module.
|
9
|
-
#
|
10
|
-
|
11
|
-
module JsonRpcObjects
|
12
|
-
|
13
|
-
##
|
14
|
-
# Abstract serializer class.
|
15
|
-
#
|
16
|
-
# @since 0.4.0
|
17
|
-
# @abstract
|
18
|
-
#
|
19
|
-
|
20
|
-
class Serializer
|
21
|
-
|
22
|
-
##
|
23
|
-
# JSON serializer using +multi_json+.
|
24
|
-
# @since 0.4.0
|
25
|
-
#
|
26
|
-
|
27
|
-
class JSON < Serializer
|
28
|
-
|
29
|
-
##
|
30
|
-
# Serializes data.
|
31
|
-
#
|
32
|
-
# @param [Object] data some data
|
33
|
-
# @return [Object] object in serialized form
|
34
|
-
#
|
35
|
-
|
36
|
-
def serialize(data)
|
37
|
-
MultiJson.encode(data)
|
38
|
-
end
|
39
|
-
|
40
|
-
##
|
41
|
-
# Deserializes data.
|
42
|
-
#
|
43
|
-
# @param [Object] data data in serialized form
|
44
|
-
# @return [Object] deserialized data
|
45
|
-
#
|
46
|
-
|
47
|
-
def deserialize(data)
|
48
|
-
MultiJson.decode(data)
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
|
-
|
4
|
-
require "json-rpc-objects/serializer"
|
5
|
-
require "yaml"
|
6
|
-
|
7
|
-
##
|
8
|
-
# Main JSON-RPC Objects module.
|
9
|
-
#
|
10
|
-
|
11
|
-
module JsonRpcObjects
|
12
|
-
|
13
|
-
##
|
14
|
-
# Abstract serializer class.
|
15
|
-
#
|
16
|
-
# @since 0.4.0
|
17
|
-
# @abstract
|
18
|
-
#
|
19
|
-
|
20
|
-
class Serializer
|
21
|
-
|
22
|
-
##
|
23
|
-
# YAML serializer using internal Ruby YAML.
|
24
|
-
# @since 0.4.0
|
25
|
-
#
|
26
|
-
|
27
|
-
class YAML < Serializer
|
28
|
-
|
29
|
-
##
|
30
|
-
# Serializes data.
|
31
|
-
#
|
32
|
-
# @param [Object] data some data
|
33
|
-
# @return [Object] object in serialized form
|
34
|
-
#
|
35
|
-
|
36
|
-
def serialize(data)
|
37
|
-
::YAML.dump(data)
|
38
|
-
end
|
39
|
-
|
40
|
-
##
|
41
|
-
# Deserializes data.
|
42
|
-
#
|
43
|
-
# @param [Object] data data in serialized form
|
44
|
-
# @return [Object] deserialized data
|
45
|
-
#
|
46
|
-
|
47
|
-
def deserialize(data)
|
48
|
-
::YAML.load(data)
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
|