gruf 2.5.0 → 2.5.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: a2452f173e2987612fde71b5e170874f52718e5a7f820658378c7a98e54f5b1f
4
- data.tar.gz: bcbb20ab199f78fadd1926d1314fe881fccda9413f149ebb8ad1e4daeba259f8
3
+ metadata.gz: 65e740037fb8efc21bd1560364abb3c9de7ae69d8e443363b8965ab617344e99
4
+ data.tar.gz: 2acbd3d7618774210218dac40e033c8d279152793aa9336f7025eb9a2a6c7e30
5
5
  SHA512:
6
- metadata.gz: d9ae08c458006784a089c1390000870febe48a01e8e6be85673e343639ec8283410c76fa6110981916f1333bc3e49c499d845cb03551cf1ea42cab8b5455c2c1
7
- data.tar.gz: 26833397af9630db7a6c3d0429ddcaaf63d84e076e8d6691719b2210b8f7523b3a89169e2826ad2f66d67dd64e313a31f87da423d5f4580c4b7ac6fc26fc54d7
6
+ metadata.gz: 1b7130c6564fa22da55c76c28f602f1f56f90033a1df736539bc3c930e9edc3cb2ea5100644fa9ee2d918d6120cc7d6a683f0a81709431a06b7fc870f98eadd6
7
+ data.tar.gz: 8247fba2ac2be6f566d9c95bb76c321cc6920e289f082fb0f513c5a3bcfe033b7c5a01c762f1472f20b2c8c401d48187382b89f4cb4faf104c4a8dcf2cedd27d
@@ -2,6 +2,11 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.5.1
6
+
7
+ - Ensure `timeout` is an int when passed as a client option to a gRPC client
8
+ - Add `bound_service` reader to `Gruf::Controllers::Base` for finding the service bound to the given controller
9
+
5
10
  ### 2.5.0
6
11
 
7
12
  - Client exceptions raised now contain mapped subclasses, such as `Gruf::Client::Errors::InvalidArgument`
@@ -1,49 +1,46 @@
1
- # Contributor Code of Conduct
1
+ # Contributor Covenant Code of Conduct
2
2
 
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
3
+ ## Our Pledge
7
4
 
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
12
16
 
13
17
  Examples of unacceptable behavior by participants include:
14
18
 
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
18
21
  * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at splittingred@gmail.com. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engineering@bigcommerce.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
47
44
 
48
45
  [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/README.md CHANGED
@@ -450,7 +450,8 @@ very large values (such as binary or json data).
450
450
  ### Controllers
451
451
 
452
452
  In order to test your controller, you first need to mock a GRPC ActiveCall. You can create the following file under `/spec/support/` path of your project:
453
- ```
453
+
454
+ ```ruby
454
455
  require 'grpc'
455
456
 
456
457
  module Rpc
@@ -471,25 +472,21 @@ end
471
472
  ```
472
473
 
473
474
  Imagine you have the following controller to test:
474
- ```
475
+
476
+ ```ruby
475
477
  class ThingController < ::Gruf::Controllers::Base
476
478
  bind ::Rpc::ThingService::Service
477
479
 
478
480
  def get_thing
479
- thing = Rpc::Thing.new(id: message_id, name: 'Foo')
481
+ thing = Rpc::Thing.new(id: request.message.id, name: 'Foo')
480
482
  Rpc::GetThingResponse.new(thing: thing)
481
483
  end
482
-
483
- private
484
-
485
- def message_id
486
- request.message.id
487
- end
488
484
  end
489
485
  ```
490
486
 
491
487
  You can stub it in the specs this way:
492
- ```
488
+
489
+ ```ruby
493
490
  describe ThingController do
494
491
  let(:rpc_service) { ::Rpc::ThingService::Service }
495
492
  let(:rpc_desc) { Rpc::ThingService::Service.rpc_descs.values.first }
@@ -510,6 +507,7 @@ describe ThingController do
510
507
 
511
508
  it 'returns an instance of Rpc::GetThingResponse' do
512
509
  expect(result).to be_instance_of(Rpc::GetThingResponse)
510
+ expect(result.id).to eq request.id
513
511
  end
514
512
  end
515
513
  end
@@ -521,16 +519,17 @@ end
521
519
  You can build your own hooks and middleware for gruf; here's a list of known open source gems for
522
520
  gruf that you can use today:
523
521
 
524
- * [gruf-zipkin](https://github.com/bigcommerce/gruf-zipkin) - Provides a [Zipkin](https://zipkin.io)
525
- integration
526
522
  * [gruf-lightstep](https://github.com/bigcommerce/gruf-lightstep) - Provides a seamless
527
523
  [LightStep](https://lightstep.com) integration
528
- * [gruf-circuit-breaker](https://github.com/bigcommerce/gruf-circuit-breaker) - Circuit breaker
529
- support for services
530
- * [gruf-profiler](https://github.com/bigcommerce/gruf-profiler) - Profiles and provides memory usage
531
- reports for clients and services
524
+ * [gruf-zipkin](https://github.com/bigcommerce/gruf-zipkin) - Provides a [Zipkin](https://zipkin.io)
525
+ integration
526
+ * [gruf-newrelic](https://github.com/bigcommerce/gruf-newrelic) - Easy [New Relic](https://newrelic.com/) integration
532
527
  * [gruf-commander](https://github.com/bigcommerce/gruf-commander) - Request/command-style validation and
533
528
  execution patterns for services
529
+ * [gruf-profiler](https://github.com/bigcommerce/gruf-profiler) - Profiles and provides memory usage
530
+ reports for clients and services
531
+ * [gruf-circuit-breaker](https://github.com/bigcommerce/gruf-circuit-breaker) - Circuit breaker
532
+ support for services
534
533
 
535
534
  ## Demo Rails App
536
535
 
@@ -59,6 +59,7 @@ module Gruf
59
59
  @opts[:password] = options.fetch(:password, '').to_s
60
60
  @opts[:hostname] = options.fetch(:hostname, Gruf.default_client_host)
61
61
  @error_factory = Gruf::Client::ErrorFactory.new
62
+ client_options[:timeout] = client_options[:timeout].to_i if client_options.key?(:timeout)
62
63
  client = "#{service}::Stub".constantize.new(@opts[:hostname], build_ssl_credentials, client_options)
63
64
  super(client)
64
65
  end
@@ -29,6 +29,11 @@ module Gruf
29
29
  # @var [Gruf::Error] error
30
30
  attr_reader :error
31
31
 
32
+ class << self
33
+ # @var [GRPC::GenericService] bound_service
34
+ attr_reader :bound_service
35
+ end
36
+
32
37
  ##
33
38
  # Initialize the controller within the given request context
34
39
  #
@@ -56,8 +61,10 @@ module Gruf
56
61
  # @param [GRPC::GenericService] service The name of the service to bind this controller to
57
62
  #
58
63
  def self.bind(service)
59
- Gruf.services << service.name.constantize
60
- ServiceBinder.new(service).bind!(self)
64
+ service_class = service.name.constantize
65
+ Gruf.services << service_class
66
+ @bound_service = service_class
67
+ ServiceBinder.new(service_class).bind!(self)
61
68
  end
62
69
 
63
70
  ##
@@ -14,5 +14,5 @@
14
14
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
15
  #
16
16
  module Gruf
17
- VERSION = '2.5.0'.freeze
17
+ VERSION = '2.5.1'.freeze
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-14 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler