twirp_rails 0.4.8 → 0.4.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1bb0eea590cb282d0b8c08ae969af2e85d09f77da0d6db73768a2e9151aeb6
|
4
|
+
data.tar.gz: e4680efb98f114aa18ee751c9f2b894c0baff3b288f2f41487a6fe3175bc54f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d5f15f647f7468adf94ca9c7e90f9791df1f417473920915ed7b0b1e923c4e8d1c17fdb8b61c3a9f9c926e8c8581e4e2c8ec606d5d3341ed8cb0400cd312c0
|
7
|
+
data.tar.gz: f5a8f247a6501f1ff4b03834b732a2a9d8ac6c838fe18c941d3834d82ae08f49bf0ecd30f4f7383f1829915be99b9c99ea314ee0f71e2a070afcd178ccf920a6
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
twirp_rails (0.4.
|
4
|
+
twirp_rails (0.4.9)
|
5
5
|
railties (~> 6.0)
|
6
|
-
twirp (~> 1)
|
6
|
+
twirp (~> 1.4)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (6.0.3.
|
12
|
-
actionview (= 6.0.3.
|
13
|
-
activesupport (= 6.0.3.
|
11
|
+
actionpack (6.0.3.2)
|
12
|
+
actionview (= 6.0.3.2)
|
13
|
+
activesupport (= 6.0.3.2)
|
14
14
|
rack (~> 2.0, >= 2.0.8)
|
15
15
|
rack-test (>= 0.6.3)
|
16
16
|
rails-dom-testing (~> 2.0)
|
17
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.0.3.
|
19
|
-
activesupport (= 6.0.3.
|
18
|
+
actionview (6.0.3.2)
|
19
|
+
activesupport (= 6.0.3.2)
|
20
20
|
builder (~> 3.1)
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (6.0.3.
|
24
|
+
activesupport (6.0.3.2)
|
25
25
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
26
|
i18n (>= 0.7, < 2)
|
27
27
|
minitest (~> 5.1)
|
@@ -33,15 +33,15 @@ GEM
|
|
33
33
|
crass (1.0.6)
|
34
34
|
diff-lcs (1.3)
|
35
35
|
erubi (1.9.0)
|
36
|
-
faraday (0.
|
36
|
+
faraday (1.0.1)
|
37
37
|
multipart-post (>= 1.2, < 3)
|
38
38
|
generator_spec (0.9.4)
|
39
39
|
activesupport (>= 3.0.0)
|
40
40
|
railties (>= 3.0.0)
|
41
|
-
google-protobuf (3.12.
|
42
|
-
i18n (1.8.
|
41
|
+
google-protobuf (3.12.2)
|
42
|
+
i18n (1.8.3)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
|
-
loofah (2.
|
44
|
+
loofah (2.6.0)
|
45
45
|
crass (~> 1.0.2)
|
46
46
|
nokogiri (>= 1.5.9)
|
47
47
|
method_source (0.9.2)
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
pry (0.12.2)
|
54
54
|
coderay (~> 1.1.0)
|
55
55
|
method_source (~> 0.9.0)
|
56
|
-
rack (2.2.
|
56
|
+
rack (2.2.3)
|
57
57
|
rack-test (1.1.0)
|
58
58
|
rack (>= 1.0, < 3)
|
59
59
|
rails-dom-testing (2.0.3)
|
@@ -61,9 +61,9 @@ GEM
|
|
61
61
|
nokogiri (>= 1.6)
|
62
62
|
rails-html-sanitizer (1.3.0)
|
63
63
|
loofah (~> 2.3)
|
64
|
-
railties (6.0.3.
|
65
|
-
actionpack (= 6.0.3.
|
66
|
-
activesupport (= 6.0.3.
|
64
|
+
railties (6.0.3.2)
|
65
|
+
actionpack (= 6.0.3.2)
|
66
|
+
activesupport (= 6.0.3.2)
|
67
67
|
method_source
|
68
68
|
rake (>= 0.8.7)
|
69
69
|
thor (>= 0.20.3, < 2.0)
|
data/README.md
CHANGED
@@ -160,7 +160,7 @@ This feature allow to use ruby style exception handling flow in ruby code.
|
|
160
160
|
|
161
161
|
Create class to describe translate error rules
|
162
162
|
```ruby
|
163
|
-
class
|
163
|
+
class ApplicationErrorTranslator < TwirpRails::ErrorHandling::Base
|
164
164
|
# rules to translate exception raised by handler to twirp
|
165
165
|
translate_exception ArgumentError, with: :invalid_argument
|
166
166
|
translate_exception ActiveRecord::NotFound do |exception, handler|
|
@@ -177,9 +177,9 @@ Create class to describe translate error rules
|
|
177
177
|
|
178
178
|
And configure TwirpRails to use it:
|
179
179
|
```ruby
|
180
|
-
# config/initializers/
|
180
|
+
# config/initializers/twirp_rails.rb
|
181
181
|
# ...
|
182
|
-
config.twirp_exception_translator_class = '
|
182
|
+
config.twirp_exception_translator_class = 'ApplicationErrorTranslator'
|
183
183
|
# ...
|
184
184
|
```
|
185
185
|
|
@@ -43,15 +43,15 @@ module TwirpRails
|
|
43
43
|
if method =~ /!$/
|
44
44
|
# when we call a bang version of client method - raise exception translated from error
|
45
45
|
method = method[0..-2]
|
46
|
-
raise_on_error client.public_send(method, args)
|
46
|
+
raise_on_error client.public_send(method, *args)
|
47
47
|
else
|
48
|
-
client.public_send method, args
|
48
|
+
client.public_send method, *args
|
49
49
|
end
|
50
50
|
end
|
51
51
|
# rubocop:enable Style/MethodMissingSuper
|
52
52
|
|
53
53
|
def respond_to_missing?(method, include_all = false)
|
54
|
-
|
54
|
+
client.respond_to?(method, include_all)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -36,7 +36,7 @@ TwirpRails.configure do |config|
|
|
36
36
|
# translate_exception Mongoid::Errors::DocumentNotFound, with: :not_found
|
37
37
|
# translate_error :not_found, with: Mongoid::Errors::DocumentNotFound
|
38
38
|
# end
|
39
|
-
# config.twirp_exception_translator_class = '
|
39
|
+
# config.twirp_exception_translator_class = 'ApplicationErrorTranslator'
|
40
40
|
# default:
|
41
41
|
# config.twirp_exception_translator_class = nil
|
42
42
|
end
|
data/lib/twirp_rails/version.rb
CHANGED
data/twirp_rails.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_dependency 'twirp', '~> 1'
|
25
|
+
spec.add_dependency 'twirp', '~> 1.4'
|
26
26
|
spec.add_dependency 'railties', '~> 6.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twirp_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandr Zimin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twirp
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1'
|
19
|
+
version: '1.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1'
|
26
|
+
version: '1.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.1.
|
185
|
+
rubygems_version: 3.1.4
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Use twirp-ruby from rails.
|