protobuf-rpc-register 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: befd552314c1337a7c701e7586d8cfcaab75f963
4
- data.tar.gz: 5747a656ec3f9aa74ae011cc688ee1748434c10f
3
+ metadata.gz: 979c0bf754eb39681d24b3ca725ba28de525660d
4
+ data.tar.gz: 5cc88cf1c896915e58ee5485f5a8c2fe186abaec
5
5
  SHA512:
6
- metadata.gz: e5199eed57f3cf1eefe6054b52e25770cf020986b7fda243877edea135059a2db3a80fbb802ceee3942b054cf3f567690a4b061b305493f65296356edabe03b6
7
- data.tar.gz: d9e90ed6eaad987d43fabe80324f0349842e38b133cc39e343d32c98201be84e88cece941279ea8c574673c8860d9b57160b83d22574fb52d87690000cc7797a
6
+ metadata.gz: d0a18a641aec1fd0822146fd571cd62d64928706e590b75f364451ce460b0974d2b176b1920395e285e63beae6c9dc633840caed668d78e142fcf4fec847b44f
7
+ data.tar.gz: 70bd33d58ae8c132e5ae28c0bbd05dc871dcc80aa162b00a78698895aedce8791576a906cfe9daaa886433a649c24ce06392c4d3a936b35bb66c2ee73a92fe81
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Protobuf::Rpc::Register
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/protobuf/rpc/register`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This gem is helping you to build rpc services quickly.
6
4
 
7
5
  ## Installation
8
6
 
@@ -32,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
30
 
33
31
  ## Contributing
34
32
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/protobuf-rpc-register. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/scorix/protobuf-rpc-register. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
34
 
37
35
 
38
36
  ## License
@@ -14,6 +14,7 @@ module Protobuf
14
14
  with.each { |m| @services[service].define_rpc(m) }
15
15
  define_client_class(service)
16
16
  end
17
+ self
17
18
  end
18
19
 
19
20
  private
@@ -24,7 +25,6 @@ module Protobuf
24
25
  else
25
26
  @module::Services.const_set(service, Class.new(Protobuf::Rpc::Services::Base))
26
27
  end
27
- @services[service].inherit_rpcs!
28
28
  end
29
29
 
30
30
  def define_client_class(service)
@@ -4,6 +4,11 @@ module Protobuf
4
4
  module Rpc
5
5
  module Interactions
6
6
  class Base < ::ActiveInteraction::Base
7
+ def presence_inputs
8
+ # todo: need more fields to let server know specified nil values, otherwise it will be ignored
9
+ inputs.reject { |k, v| !given?(k) && v.nil? }
10
+ end
11
+
7
12
  def self.except_attributes
8
13
  [].freeze
9
14
  end
@@ -1,7 +1,7 @@
1
1
  module Protobuf
2
2
  module Rpc
3
3
  module Register
4
- VERSION = "0.1.1".freeze
4
+ VERSION = "0.2.0".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -49,6 +49,7 @@ module Protobuf
49
49
  end
50
50
 
51
51
  def self.load(msg)
52
+ return msg unless msg.is_a?(Messages::RpcCompressedMessage)
52
53
  body = msg.compressed ? ActiveSupport::Gzip.decompress(msg.response_body) : msg.response_body
53
54
 
54
55
  if msg.response_type.present?
@@ -13,12 +13,16 @@ module Protobuf
13
13
  respond_with Serializer.dump(msg)
14
14
  end
15
15
 
16
+ def self.inherited(subclass)
17
+ subclass.inherit_rpcs!
18
+ end
19
+
16
20
  def self.namespace
17
21
  self.name.deconstantize.deconstantize
18
22
  end
19
23
 
20
24
  def self.inherit_rpcs!
21
- superclass.rpcs.keys.each { |x| define_rpc(x, superclass.msgclass) }
25
+ superclass.rpcs.keys.each { |x| define_rpc(x) }
22
26
  end
23
27
 
24
28
  def self.define_rpc(method, req = ::Protobuf::Rpc::Messages::RpcCompressedMessage, res = ::Protobuf::Rpc::Messages::RpcCompressedMessage)
@@ -29,6 +33,8 @@ module Protobuf
29
33
  result = nil
30
34
  req = Serializer.load(request)
31
35
 
36
+ logger.debug(req.to_hash)
37
+
32
38
  begin
33
39
  interaction = Object.const_get("#{self.class.namespace}::Interactions::#{self.class.name.demodulize}::#{class_name}", false)
34
40
  rescue NameError => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-rpc-register
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - scorix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-11 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler