protobuf 3.7.1 → 3.7.2.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protobuf.rb +11 -0
- data/lib/protobuf/rpc/error.rb +1 -1
- data/lib/protobuf/rpc/middleware/response_encoder.rb +2 -2
- data/lib/protobuf/rpc/rpc.pb.rb +1 -0
- data/lib/protobuf/version.rb +1 -1
- data/proto/rpc.proto +1 -0
- data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +4 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4f0794925c7662d3fce4dc28345e914f33115b
|
4
|
+
data.tar.gz: 626caedcbe40e19f74a4d5a8a2a5f22814e03e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f02a0023e1229c1201523c5cc857ca4a4e6ab88008addc5283e633d497009b3c48e1374b868740e89cdc9b6a544e0a6130405704f37a02560463614d5cbd74
|
7
|
+
data.tar.gz: da8b4e50a0420a0182c5f7ae2f09baebd1c4e800beb69e7b915b06201fd447b7893641c4b0bbdd6e0cdbd751853b79e017a415c5390c81b3d52d89829f7d55c3
|
data/lib/protobuf.rb
CHANGED
@@ -37,6 +37,13 @@ module Protobuf
|
|
37
37
|
#
|
38
38
|
# The name or address of the host to use during client RPC calls.
|
39
39
|
attr_writer :client_host
|
40
|
+
|
41
|
+
# Server Host
|
42
|
+
#
|
43
|
+
# Default: first ipv4 address of the system
|
44
|
+
#
|
45
|
+
# The name or address of the host to use during client RPC calls.
|
46
|
+
attr_writer :server_host
|
40
47
|
end
|
41
48
|
|
42
49
|
def self.client_host
|
@@ -81,6 +88,10 @@ module Protobuf
|
|
81
88
|
def self.ignore_unknown_fields=(value)
|
82
89
|
@ignore_unknown_fields = !!value
|
83
90
|
end
|
91
|
+
|
92
|
+
def self.server_host
|
93
|
+
@server_host ||= Socket.gethostname
|
94
|
+
end
|
84
95
|
end
|
85
96
|
|
86
97
|
unless ENV.key?('PB_NO_NETWORKING')
|
data/lib/protobuf/rpc/error.rb
CHANGED
@@ -18,7 +18,7 @@ module Protobuf
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def to_response
|
21
|
-
::Protobuf::Socketrpc::Response.new(:error => message, :error_reason => error_type)
|
21
|
+
::Protobuf::Socketrpc::Response.new(:error => message, :error_reason => error_type, :server => ::Protobuf.server_host)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -72,9 +72,9 @@ module Protobuf
|
|
72
72
|
#
|
73
73
|
def wrapped_response
|
74
74
|
if response.is_a?(::Protobuf::Rpc::PbError)
|
75
|
-
::Protobuf::Socketrpc::Response.new(:error => response.message, :error_reason => response.error_type)
|
75
|
+
::Protobuf::Socketrpc::Response.new(:error => response.message, :error_reason => response.error_type, :server => ::Protobuf.server_host)
|
76
76
|
else
|
77
|
-
::Protobuf::Socketrpc::Response.new(:response_proto => response.encode)
|
77
|
+
::Protobuf::Socketrpc::Response.new(:response_proto => response.encode, :server => ::Protobuf.server_host)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
data/lib/protobuf/rpc/rpc.pb.rb
CHANGED
data/lib/protobuf/version.rb
CHANGED
data/proto/rpc.proto
CHANGED
@@ -38,6 +38,7 @@ message Response
|
|
38
38
|
optional string error = 2; // Error message, if any
|
39
39
|
optional bool callback = 3 [default = false]; // Was callback invoked (not sure what this is for)
|
40
40
|
optional ErrorReason error_reason = 4; // Error Reason
|
41
|
+
optional string server = 5; // Server hostname or address
|
41
42
|
}
|
42
43
|
|
43
44
|
// Possible error reasons
|
@@ -10,10 +10,13 @@ RSpec.describe Protobuf::Rpc::Middleware::ResponseEncoder do
|
|
10
10
|
end
|
11
11
|
let(:encoded_response) { response_wrapper.encode }
|
12
12
|
let(:response) { Test::Resource.new(:name => 'required') }
|
13
|
-
let(:response_wrapper) { ::Protobuf::Socketrpc::Response.new(:response_proto => response) }
|
13
|
+
let(:response_wrapper) { ::Protobuf::Socketrpc::Response.new(:response_proto => response, :server => server_host) }
|
14
|
+
let(:server_host) { 'beepboopbop' }
|
14
15
|
|
15
16
|
subject { described_class.new(app) }
|
16
17
|
|
18
|
+
before { ::Protobuf.server_host = server_host }
|
19
|
+
|
17
20
|
describe "#call" do
|
18
21
|
it "encodes the response" do
|
19
22
|
stack_env = subject.call(env)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.2.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -458,9 +458,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
458
458
|
version: '0'
|
459
459
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
460
460
|
requirements:
|
461
|
-
- - "
|
461
|
+
- - ">"
|
462
462
|
- !ruby/object:Gem::Version
|
463
|
-
version:
|
463
|
+
version: 1.3.1
|
464
464
|
requirements: []
|
465
465
|
rubyforge_project:
|
466
466
|
rubygems_version: 2.5.2
|