twirp_rails 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -3
- data/Gemfile.lock +1 -1
- data/lib/twirp_rails/rspec/helper.rb +15 -2
- data/lib/twirp_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afb781b860d752d9ccf6eff558d3e07a7f93923ecf5b70dbbb3a7df373ff60c8
|
4
|
+
data.tar.gz: ee22bba018427cb6d0c29be51a89bec3a40c464a7a67856b1169d72afecb73b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14ef916943fec1782354d2349ae4c38fd918a98331d0f4827c3b7a24847720c01a2d8e414c09b4d39d99ae31bfeffb27fbe5f2d9e13b2444065cf83e0399dab
|
7
|
+
data.tar.gz: 7f9ad8ccca240630862a59c107987cf1c3e371392c3e373f5cdb268f04ea24a6db091fe7d5a174bfc58430f1cde21e95e3c74466fd199b647a7bc145c18b9572
|
data/CHANGELOG.md
CHANGED
@@ -4,12 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## 0.1.
|
7
|
+
## 0.1.5 - 2020-02-04
|
8
8
|
|
9
9
|
### Added
|
10
|
-
-
|
10
|
+
- rspec ```rpc``` helper try to camelize tested method name if it not exists
|
11
11
|
|
12
|
-
## 0.1.
|
12
|
+
## 0.1.4 - 2020-02-03
|
13
13
|
|
14
14
|
### Added
|
15
15
|
- ```to_twirp``` and ```twirp_message``` methods to easy convert active record models to protobuf DTOs
|
@@ -29,6 +29,11 @@ describe TeamsHandler do
|
|
29
29
|
end
|
30
30
|
```
|
31
31
|
|
32
|
+
## 0.1.3 - 2020-01-28
|
33
|
+
|
34
|
+
### Added
|
35
|
+
- convert package.message type to Package::Message
|
36
|
+
|
32
37
|
### Fixed
|
33
38
|
- twirp_ruby missing module workaround https://github.com/twitchtv/twirp-ruby/issues/48
|
34
39
|
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ module TwirpRails
|
|
3
3
|
module Helper
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
6
|
+
class_methods do
|
7
7
|
# places to subject service method returned value converted to_h
|
8
8
|
# @param [Boolean] to_h - default true, set to false to use pure result
|
9
9
|
# @param [Proc] block - should return array with method name and arguments
|
@@ -12,8 +12,21 @@ module TwirpRails
|
|
12
12
|
# it { should match(id: 1)}
|
13
13
|
def rpc(to_h: true, &block)
|
14
14
|
let :rpc_args, &block
|
15
|
+
|
15
16
|
subject do
|
16
|
-
|
17
|
+
method, *args = rpc_args
|
18
|
+
|
19
|
+
unless service.class.rpcs[method.to_s]
|
20
|
+
camelized_method = method.to_s.camelize
|
21
|
+
|
22
|
+
if service.class.rpcs[camelized_method]
|
23
|
+
method = camelized_method
|
24
|
+
else
|
25
|
+
raise "Methods #{method}/#{camelized_method} is not found in the service #{service.class}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
result = service.call_rpc(method, *args)
|
17
30
|
to_h ? result.to_h : result
|
18
31
|
end
|
19
32
|
end
|
data/lib/twirp_rails/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.5
|
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-02-
|
11
|
+
date: 2020-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twirp
|