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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 292380b89f2b938b849edb2e4ce46cb84e197b6a39592d16425440446adce9a1
4
- data.tar.gz: 64be8b4452a96b256adc5bfe9d08a479392d9cb916f4fe0ab1135cc763728f87
3
+ metadata.gz: fce3ed5388747c254df01adbd95139180c434b3b012c6c0983bd15a3973921bf
4
+ data.tar.gz: 61c27cfac06badede4fec86c61dd3b718e3731d8c6a4504bb8cbcb5ba3965181
5
5
  SHA512:
6
- metadata.gz: c4f52185995140dc0d2aa2646227bbd9195a87941a1ab40a20d6e1dfb1b29bf24c9b0a50796db26fecd453f802fecc5bd5003eee284f325ccea3a96bf4f152a6
7
- data.tar.gz: fa2e3ed00ed69f960dae3c500979fc8a745cd6e78015c68d6b963ee85ffad842070855abcdd8d50e6f37263f2789ead2f231d50092698c496bd0e4e5b8251970
6
+ metadata.gz: 030f3f2b9930d73e40ad4b2a4ed6fe26dcb84588e5c1378c7c892b20d64ee579d168df3906843878118eb435b1ebedc948944aefb8c45d552c4c3a5ec24d485e
7
+ data.tar.gz: 7cc323899b49557945f0e53796308d02cafde3dfe9829b9fbb0abfb91c4cdd5f4137828e2be87d20bd4ebe1f66d475fd18166df45eb1adf4da965152ea50b9f2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### v0.4.1 (2022-12-15)
2
+ - protobuf type support
3
+ - gemspec cleanup
4
+ - build upgrade
5
+ - dependabot
6
+ - respond to improvement
7
+
1
8
  ### v0.4.0 (2022-11-16)
2
9
  - .to_return(Twirp::ClientResp)
3
10
  - revert client class name filter
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
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 respond_to?(name)
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 respond_to?(method_name, include_private = false)
17
- super || @stub.respond_to?(method_name)
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
@@ -1,5 +1,5 @@
1
1
  module WebMock
2
2
  module Twirp
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  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
@@ -1,25 +1,15 @@
1
- package_name = File.basename(__FILE__).split(".")[0]
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.homepage = "https://github.com/dpep/#{package_name}"
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.files = Dir[
17
- __FILE__,
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.0
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-16 00:00:00.000000000 Z
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: Gem::Specification::WebMock::Twirp
172
+ summary: WebMock::Twirp
170
173
  test_files: []