krpc 0.4.0.beta1 → 0.4.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/krpc.gemspec +1 -1
- data/lib/krpc/client.rb +2 -2
- data/lib/krpc/error.rb +12 -4
- data/lib/krpc/gen.rb +1 -1
- data/lib/krpc/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e7d575d4a1dbb6498787b0e82a39730f94f0d0d
|
4
|
+
data.tar.gz: 79568d6c4d305a5921ebc5c4c646825ccf484f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c23caec29dd780b472326b178f914db6b9b6751c7e109d05df181c9cb3a45bc55cbecf2f0fff2f624f4ad7e2e67740285307ea000a3b3a76db574453a7463ac0
|
7
|
+
data.tar.gz: 9b6725253fe71724ed3ceb2b22280a46bda329a339fb2d05b8bcda88f2fd6e5515883cd030547e8d326b3d8d3b06eb986cef375895a26a33b8f99eb17fcc4531
|
data/krpc.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.homepage = "https://github.com/TeWu/krpc-rb"
|
16
16
|
s.license = "GPL-3.0"
|
17
17
|
|
18
|
-
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(doc|test|spec|features|bin
|
18
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(doc|test|spec|features|bin)/|Rakefile|CHANGELOG}) || f.start_with?('.') }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
s.extra_rdoc_files = ["README.md"]
|
21
21
|
s.rdoc_options << "--markup" << "markdown" <<
|
data/lib/krpc/client.rb
CHANGED
@@ -107,7 +107,7 @@ module KRPC
|
|
107
107
|
# client.close
|
108
108
|
def generate_services_api!
|
109
109
|
return self if services_api_generated?
|
110
|
-
raise(
|
110
|
+
raise(Error, "Can't generate the services API while not connected to a server -- call Client#connect! to connect to server and generate the services API in one call") if not connected?
|
111
111
|
|
112
112
|
resp = core.get_services
|
113
113
|
resp.services.each do |service_msg|
|
@@ -139,7 +139,7 @@ module KRPC
|
|
139
139
|
nil
|
140
140
|
end
|
141
141
|
rescue IOError => e
|
142
|
-
raise(
|
142
|
+
raise(Error, "RPC call attempt while not connected to a server -- call Client#connect first") if not connected?
|
143
143
|
raise e
|
144
144
|
end
|
145
145
|
|
data/lib/krpc/error.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
|
2
2
|
module KRPC
|
3
3
|
|
4
|
-
class
|
5
|
-
class
|
6
|
-
|
7
|
-
|
4
|
+
class Error < Exception; end
|
5
|
+
class UTF8MessageError < Error
|
6
|
+
def initialize(msg = nil)
|
7
|
+
super(msg.nil? ? msg : msg.encode(Encoding::UTF_8, invalid: :replace, undef: :replace))
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class ConnectionError < UTF8MessageError; end
|
12
|
+
class RPCError < UTF8MessageError; end
|
13
|
+
class ValueError < Error; end
|
14
|
+
class ProcedureNameParserError < Error; end
|
8
15
|
|
9
16
|
|
17
|
+
class ArgumentError < Error; end
|
10
18
|
class ArgumentErrorSig < ArgumentError
|
11
19
|
attr_reader :message_without_signature, :signature
|
12
20
|
|
data/lib/krpc/gen.rb
CHANGED
@@ -62,7 +62,7 @@ module KRPC
|
|
62
62
|
define_singleton_method method_name do |*args|
|
63
63
|
Gen.transform_exceptions(cls, method_name, prepend_self_to_args) do
|
64
64
|
raise ArgumentErrorSig.new("missing argument for parameter \"client\"") if args.count < 1
|
65
|
-
raise ArgumentErrorSig.new("argument for parameter \"client\" must be a #{KRPC::Client.name} -- got #{args.first.inspect} of type #{args.first.class}") unless args.first.is_a?(KRPC::Client)
|
65
|
+
raise ArgumentErrorSig.new("argument for parameter \"client\" must be a #{::KRPC::Client.name} -- got #{args.first.inspect} of type #{args.first.class}") unless args.first.is_a?(::KRPC::Client)
|
66
66
|
client = args.shift
|
67
67
|
kwargs = args.extract_kwargs!
|
68
68
|
client.execute_rpc(service_name, proc.name, args, kwargs, param_names, param_types, param_default, return_type: return_type)
|
data/lib/krpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: krpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Więch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -184,4 +184,3 @@ signing_key:
|
|
184
184
|
specification_version: 4
|
185
185
|
summary: Client library for kRPC
|
186
186
|
test_files: []
|
187
|
-
has_rdoc:
|