webmock-twirp 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +91 -0
- data/lib/webmock/twirp/matchers/make_twirp_request.rb +3 -3
- data/lib/webmock/twirp/request_stub.rb +6 -0
- data/lib/webmock/twirp/version.rb +1 -1
- data/service.rb +26 -0
- data/webmock-twirp.gemspec +6 -16
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fce3ed5388747c254df01adbd95139180c434b3b012c6c0983bd15a3973921bf
|
4
|
+
data.tar.gz: 61c27cfac06badede4fec86c61dd3b718e3731d8c6a4504bb8cbcb5ba3965181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030f3f2b9930d73e40ad4b2a4ed6fe26dcb84588e5c1378c7c892b20d64ee579d168df3906843878118eb435b1ebedc948944aefb8c45d552c4c3a5ec24d485e
|
7
|
+
data.tar.gz: 7cc323899b49557945f0e53796308d02cafde3dfe9829b9fbb0abfb91c4cdd5f4137828e2be87d20bd4ebe1f66d475fd18166df45eb1adf4da965152ea50b9f2
|
data/CHANGELOG.md
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
webmock-twirp (0.4.0)
|
5
|
+
twirp (>= 1)
|
6
|
+
webmock (>= 3)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.8.1)
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
13
|
+
byebug (11.1.3)
|
14
|
+
codecov (0.6.0)
|
15
|
+
simplecov (>= 0.15, < 0.22)
|
16
|
+
crack (0.4.5)
|
17
|
+
rexml
|
18
|
+
diff-lcs (1.5.0)
|
19
|
+
docile (1.4.0)
|
20
|
+
faraday (1.10.2)
|
21
|
+
faraday-em_http (~> 1.0)
|
22
|
+
faraday-em_synchrony (~> 1.0)
|
23
|
+
faraday-excon (~> 1.1)
|
24
|
+
faraday-httpclient (~> 1.0)
|
25
|
+
faraday-multipart (~> 1.0)
|
26
|
+
faraday-net_http (~> 1.0)
|
27
|
+
faraday-net_http_persistent (~> 1.0)
|
28
|
+
faraday-patron (~> 1.0)
|
29
|
+
faraday-rack (~> 1.0)
|
30
|
+
faraday-retry (~> 1.0)
|
31
|
+
ruby2_keywords (>= 0.0.4)
|
32
|
+
faraday-em_http (1.0.0)
|
33
|
+
faraday-em_synchrony (1.0.0)
|
34
|
+
faraday-excon (1.1.0)
|
35
|
+
faraday-httpclient (1.0.1)
|
36
|
+
faraday-multipart (1.0.4)
|
37
|
+
multipart-post (~> 2)
|
38
|
+
faraday-net_http (1.0.1)
|
39
|
+
faraday-net_http_persistent (1.2.0)
|
40
|
+
faraday-patron (1.0.0)
|
41
|
+
faraday-rack (1.0.0)
|
42
|
+
faraday-retry (1.0.3)
|
43
|
+
google-protobuf (3.21.12)
|
44
|
+
hashdiff (1.0.1)
|
45
|
+
multipart-post (2.2.3)
|
46
|
+
public_suffix (5.0.1)
|
47
|
+
rack (3.0.2)
|
48
|
+
rexml (3.2.5)
|
49
|
+
rspec (3.12.0)
|
50
|
+
rspec-core (~> 3.12.0)
|
51
|
+
rspec-expectations (~> 3.12.0)
|
52
|
+
rspec-mocks (~> 3.12.0)
|
53
|
+
rspec-core (3.12.0)
|
54
|
+
rspec-support (~> 3.12.0)
|
55
|
+
rspec-expectations (3.12.0)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.12.0)
|
58
|
+
rspec-mocks (3.12.1)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.12.0)
|
61
|
+
rspec-support (3.12.0)
|
62
|
+
ruby2_keywords (0.0.5)
|
63
|
+
simplecov (0.21.2)
|
64
|
+
docile (~> 1.1)
|
65
|
+
simplecov-html (~> 0.11)
|
66
|
+
simplecov_json_formatter (~> 0.1)
|
67
|
+
simplecov-html (0.12.3)
|
68
|
+
simplecov_json_formatter (0.1.4)
|
69
|
+
twirp (1.9.0)
|
70
|
+
faraday (< 2)
|
71
|
+
google-protobuf (~> 3.0, >= 3.7.0)
|
72
|
+
webmock (3.18.1)
|
73
|
+
addressable (>= 2.8.0)
|
74
|
+
crack (>= 0.3.2)
|
75
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
76
|
+
webrick (1.7.0)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
byebug
|
83
|
+
codecov
|
84
|
+
rack
|
85
|
+
rspec
|
86
|
+
simplecov
|
87
|
+
webmock-twirp!
|
88
|
+
webrick
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
2.3.17
|
@@ -7,14 +7,14 @@ module WebMock
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def method_missing(name, *args, **kwargs, &block)
|
10
|
-
super unless
|
10
|
+
return super unless respond_to_missing?(name)
|
11
11
|
@stub.send(name, *args, **kwargs, &block)
|
12
12
|
|
13
13
|
self
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
16
|
+
def respond_to_missing?(method_name, include_private = false)
|
17
|
+
@stub.respond_to?(method_name)
|
18
18
|
end
|
19
19
|
|
20
20
|
def matches?(block)
|
@@ -182,6 +182,12 @@ module WebMock
|
|
182
182
|
else
|
183
183
|
raise ArgumentError, "invalid http error status: #{obj}"
|
184
184
|
end
|
185
|
+
when Class
|
186
|
+
unless obj == msg_class
|
187
|
+
raise TypeError, "Expected type #{msg_class}, found #{obj}"
|
188
|
+
end
|
189
|
+
|
190
|
+
obj.new
|
185
191
|
else
|
186
192
|
raise ArgumentError, "can not generate twirp reponse from: #{obj}"
|
187
193
|
end
|
data/service.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "google/protobuf"
|
4
|
+
require "rack"
|
5
|
+
require "twirp"
|
6
|
+
require "webrick"
|
7
|
+
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
|
8
|
+
|
9
|
+
server = WEBrick::HTTPServer.new(Port: 3000)
|
10
|
+
|
11
|
+
handler = EchoHandler.new
|
12
|
+
service = EchoService.new(handler)
|
13
|
+
path_prefix = "/twirp/" + service.full_name
|
14
|
+
server.mount path_prefix, Rack::Handler::WEBrick, service
|
15
|
+
|
16
|
+
# handler = ComplexHandler.new
|
17
|
+
# service = ComplexService.new(handler)
|
18
|
+
# path_prefix = "/twirp/" + service.full_name
|
19
|
+
# server.mount path_prefix, Rack::Handler::WEBrick, service
|
20
|
+
|
21
|
+
server.start
|
22
|
+
|
23
|
+
# client = EchoClient.new("http://localhost:3000/twirp")
|
24
|
+
# client = ComplexClient.new("http://localhost:3000/twirp")
|
25
|
+
# resp = client.echo(msg: "World")
|
26
|
+
# puts resp.data
|
data/webmock-twirp.gemspec
CHANGED
@@ -1,25 +1,15 @@
|
|
1
|
-
|
2
|
-
load Dir.glob("lib/**/version.rb")[0]
|
3
|
-
|
1
|
+
require_relative "lib/webmock/twirp/version"
|
4
2
|
package = WebMock::Twirp
|
5
3
|
|
6
|
-
|
7
4
|
Gem::Specification.new do |s|
|
8
|
-
s.name = package_name
|
9
|
-
s.version = package.const_get "VERSION"
|
10
5
|
s.authors = ["Daniel Pepper"]
|
11
|
-
s.summary = package.to_s
|
12
6
|
s.description = "Twirp support for WebMock"
|
13
|
-
s.
|
7
|
+
s.files = `git ls-files * ':!:spec'`.split("\n")
|
8
|
+
s.homepage = "https://github.com/dpep/webmock-twirp"
|
14
9
|
s.license = "MIT"
|
15
|
-
|
16
|
-
s.
|
17
|
-
|
18
|
-
'lib/**/*',
|
19
|
-
'CHANGELOG*',
|
20
|
-
'LICENSE*',
|
21
|
-
'README*',
|
22
|
-
]
|
10
|
+
s.name = File.basename(__FILE__).split(".")[0]
|
11
|
+
s.summary = package.to_s
|
12
|
+
s.version = package.const_get "VERSION"
|
23
13
|
|
24
14
|
s.add_dependency "webmock", ">= 3"
|
25
15
|
s.add_dependency "twirp", ">= 1"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock-twirp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webmock
|
@@ -129,6 +129,8 @@ extensions: []
|
|
129
129
|
extra_rdoc_files: []
|
130
130
|
files:
|
131
131
|
- CHANGELOG.md
|
132
|
+
- Gemfile
|
133
|
+
- Gemfile.lock
|
132
134
|
- LICENSE.txt
|
133
135
|
- README.md
|
134
136
|
- lib/webmock-twirp.rb
|
@@ -143,6 +145,7 @@ files:
|
|
143
145
|
- lib/webmock/twirp/request_stub.rb
|
144
146
|
- lib/webmock/twirp/stub_request_snippet.rb
|
145
147
|
- lib/webmock/twirp/version.rb
|
148
|
+
- service.rb
|
146
149
|
- webmock-twirp.gemspec
|
147
150
|
homepage: https://github.com/dpep/webmock-twirp
|
148
151
|
licenses:
|
@@ -166,5 +169,5 @@ requirements: []
|
|
166
169
|
rubygems_version: 3.3.7
|
167
170
|
signing_key:
|
168
171
|
specification_version: 4
|
169
|
-
summary:
|
172
|
+
summary: WebMock::Twirp
|
170
173
|
test_files: []
|