gruf-commander 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/README.md +134 -0
- data/gruf-commander.gemspec +38 -0
- data/lib/gruf/commander.rb +28 -0
- data/lib/gruf/commander/command.rb +32 -0
- data/lib/gruf/commander/request.rb +62 -0
- data/lib/gruf/commander/request_validation_interceptor.rb +41 -0
- data/lib/gruf/commander/version.rb +20 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c59f4d4bddadc12d9556193015afd51ad938873
|
4
|
+
data.tar.gz: c40f4cdae1e93b7f2acc56e4f15c9cab11efb743
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ac8edc95b097eaf9b28bf3bc91935660c2ce40e384ec4002a6fb3fd8a53cfc1e4078085c0d2c5b711c6d3e1cfe2fc1869c9ede72a125c3425ff3cbdcf526b5a
|
7
|
+
data.tar.gz: 0d6b8177f2841c931f77264e0f4996666b7c7bd3b943e0217ddc9457eb4100b2064a16d8c465934fbde98b371056b46758f0a1a45cec420a621ec61892550b93
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
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.
|
7
|
+
|
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.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* 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]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/README.md
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# Gruf Commander
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.com/bigcommerce/gruf-commander.svg?token=D3Cc4LCF9BgpUx4dpPpv&branch=master)](https://travis-ci.com/bigcommerce/gruf-commander) [![Gem Version](https://badge.fury.io/rb/gruf-commander.svg)](https://badge.fury.io/rb/gruf-commander) [![Documentation](https://inch-ci.org/github/bigcommerce/gruf-commander.svg?branch=master)](https://inch-ci.org/github/bigcommerce/gruf-commander?branch=master)
|
4
|
+
|
5
|
+
Assists with request/command-style syntax and separated validation layer in [gruf](https://github.com/bigcommerce/gruf)
|
6
|
+
requests.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'gruf-commander'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install gruf-commander
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Gruf Commander supports the Command/Request design pattern. You create Request classes that perform validation,
|
27
|
+
and then submit themselves to a Command. The Command class then performs the business logic by interacting
|
28
|
+
with internal layers of the application, such as the service, DTO, or repository layers.
|
29
|
+
|
30
|
+
First, in your gruf initializer, add the interceptor:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Gruf.configure do |c|
|
34
|
+
c.interceptors.use(Gruf::Commander::RequestValidationInterceptor)
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
Then you'll create your command and request classes:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
class CreateBoxCommand < Gruf::Commander::Command
|
42
|
+
def call(request)
|
43
|
+
Box.create!(width: request.width, height: request.height)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
class CreateBoxRequest < Gruf::Commander::Request
|
49
|
+
attr_reader :width
|
50
|
+
attr_reader :height
|
51
|
+
|
52
|
+
validate :validate_width, :validate_height
|
53
|
+
|
54
|
+
def initialize(width:, height:)
|
55
|
+
@width = width
|
56
|
+
@height = height
|
57
|
+
super(command: CreateBoxCommand.new)
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def validate_width
|
63
|
+
return if @width.to_i > 0
|
64
|
+
errors.add(:width, :invalid_width, message: 'Please enter a valid width!')
|
65
|
+
end
|
66
|
+
|
67
|
+
def validate_height
|
68
|
+
return if @height.to_i > 0
|
69
|
+
errors.add(:height, :invalid_height, message: 'Please enter a valid height!')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
Then, in your gruf controller:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
def create_box
|
78
|
+
request = CreateBoxRequest.new(
|
79
|
+
width: request.message.width.to_i,
|
80
|
+
height: request.message.height.to_i,
|
81
|
+
)
|
82
|
+
box = request.submit!
|
83
|
+
Rpc::CreateBoxResponse.new(
|
84
|
+
box: Rpc::Box.new(height: box.height, width: box.width)
|
85
|
+
)
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
Gruf Commander will automatically handle the validation errors to push back to the grpc server, properly sending an
|
90
|
+
`GRPC::InvalidArgument` exception should validation fail.
|
91
|
+
|
92
|
+
### Configuration
|
93
|
+
|
94
|
+
You can configure the request validation options:
|
95
|
+
|
96
|
+
|Config Name|Description|Default|
|
97
|
+
|---|---|---|
|
98
|
+
|`invalid_request_error_code`|Sets the gRPC error code sent back on failed validation.|`:invalid_argument`|
|
99
|
+
|`invalid_request_app_error_code`|Sets the app error code sent back on failed validation.|`:invalid_request`|
|
100
|
+
|`invalid_request_message`|Sets the error message sent back on failed validation.|Invalid Request|
|
101
|
+
|
102
|
+
### Dependency Injection
|
103
|
+
|
104
|
+
Gruf Commander works very well with DI systems such as [dry-rb](http://dry-rb.org/), since Request objects can simply
|
105
|
+
just provide accessors to modify their attributes, and commands are simple plain classes that can have no strict
|
106
|
+
contract on initialization.
|
107
|
+
|
108
|
+
We recommend using a DI system (such as dry-rb) to use with Gruf Commander, as it helps with testing and refactoring
|
109
|
+
in more complex applications.
|
110
|
+
|
111
|
+
## Testing
|
112
|
+
|
113
|
+
Tests are run via rspec:
|
114
|
+
|
115
|
+
```bash
|
116
|
+
bundle exec rspec
|
117
|
+
```
|
118
|
+
|
119
|
+
## License
|
120
|
+
|
121
|
+
Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
122
|
+
|
123
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
124
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
125
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
126
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
127
|
+
|
128
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
129
|
+
Software.
|
130
|
+
|
131
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
132
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
133
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
134
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
#
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
9
|
+
# Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
#
|
16
|
+
lib = File.expand_path('../lib', __FILE__)
|
17
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
18
|
+
require 'gruf/commander/version'
|
19
|
+
|
20
|
+
Gem::Specification.new do |spec|
|
21
|
+
spec.name = 'gruf-commander'
|
22
|
+
spec.version = Gruf::Commander::VERSION
|
23
|
+
spec.authors = ['Shaun McCormick']
|
24
|
+
spec.email = ['splittingred@gmail.com']
|
25
|
+
|
26
|
+
spec.summary = 'Command/request syntax helper for gruf'
|
27
|
+
spec.description = spec.summary
|
28
|
+
spec.homepage = 'https://github.com/bigcommerce/gruf-commander'
|
29
|
+
|
30
|
+
spec.files = Dir['README.md', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', 'lib/**/*', 'gruf-commander.gemspec']
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
|
33
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
34
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
|
+
|
37
|
+
spec.add_runtime_dependency 'activemodel', '>= 4'
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
#
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
9
|
+
# Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
#
|
16
|
+
require 'active_model'
|
17
|
+
require_relative 'commander/version'
|
18
|
+
require_relative 'commander/command'
|
19
|
+
require_relative 'commander/request'
|
20
|
+
require_relative 'commander/request_validation_interceptor'
|
21
|
+
|
22
|
+
module Gruf
|
23
|
+
##
|
24
|
+
# Base module for Gruf Commander
|
25
|
+
#
|
26
|
+
module Commander
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
#
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
9
|
+
# Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
#
|
16
|
+
module Gruf
|
17
|
+
module Commander
|
18
|
+
##
|
19
|
+
# Abstract class to be extended and implemented in your command classes.
|
20
|
+
#
|
21
|
+
class Command
|
22
|
+
##
|
23
|
+
# @param [Request] request
|
24
|
+
#
|
25
|
+
# :nocov:
|
26
|
+
def call(request)
|
27
|
+
raise NotImplementedError, "Please implement :call on the command to handle #{request.class}"
|
28
|
+
end
|
29
|
+
# :nocov:
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
#
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
9
|
+
# Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
#
|
16
|
+
module Gruf
|
17
|
+
module Commander
|
18
|
+
##
|
19
|
+
# Used when submitting requests from commands; utilize to issue a validation exception on a request
|
20
|
+
#
|
21
|
+
class InvalidRequest < StandardError
|
22
|
+
attr_reader :request
|
23
|
+
|
24
|
+
##
|
25
|
+
# @param [Request] request
|
26
|
+
# @param [String] message
|
27
|
+
#
|
28
|
+
def initialize(request, message = '')
|
29
|
+
@request = request
|
30
|
+
super(message)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Base request class
|
36
|
+
#
|
37
|
+
class Request
|
38
|
+
include ActiveModel::Validations
|
39
|
+
|
40
|
+
# @var [Command] command
|
41
|
+
attr_reader :command
|
42
|
+
|
43
|
+
##
|
44
|
+
# @param [Command] command
|
45
|
+
#
|
46
|
+
def initialize(command:)
|
47
|
+
@command = command
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Validate and submit the request
|
52
|
+
#
|
53
|
+
# @raise [InvalidRequest] if the request is invalid
|
54
|
+
# rubocop:disable Style/RaiseArgs
|
55
|
+
def submit!
|
56
|
+
raise InvalidRequest.new(self) unless valid?
|
57
|
+
command.call(self)
|
58
|
+
end
|
59
|
+
# rubocop:enable Style/RaiseArgs
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
#
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
9
|
+
# Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
#
|
16
|
+
module Gruf
|
17
|
+
module Commander
|
18
|
+
##
|
19
|
+
# Does request validation error handling
|
20
|
+
#
|
21
|
+
class RequestValidationInterceptor < ::Gruf::Interceptors::ServerInterceptor
|
22
|
+
##
|
23
|
+
# Intercept the request and properly handle validation failures
|
24
|
+
#
|
25
|
+
def call
|
26
|
+
yield # this returns the protobuf message
|
27
|
+
rescue Gruf::Commander::InvalidRequest => e
|
28
|
+
e.request.errors.details.each do |attr, errs|
|
29
|
+
errs.each_with_index do |err, idx|
|
30
|
+
add_field_error(attr, err.values.first.to_sym, e.request.errors.messages[attr].fetch(idx, ''))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
fail!(
|
34
|
+
options.fetch(:invalid_request_error_code, :invalid_argument),
|
35
|
+
options.fetch(:invalid_request_app_error_code, :invalid_request),
|
36
|
+
options.fetch(:invalid_request_message, 'Invalid request')
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
#
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
9
|
+
# Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
#
|
16
|
+
module Gruf
|
17
|
+
module Commander
|
18
|
+
VERSION = '0.1.1'.freeze
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gruf-commander
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shaun McCormick
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activemodel
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4'
|
69
|
+
description: Command/request syntax helper for gruf
|
70
|
+
email:
|
71
|
+
- splittingred@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- CHANGELOG.md
|
77
|
+
- CODE_OF_CONDUCT.md
|
78
|
+
- README.md
|
79
|
+
- gruf-commander.gemspec
|
80
|
+
- lib/gruf/commander.rb
|
81
|
+
- lib/gruf/commander/command.rb
|
82
|
+
- lib/gruf/commander/request.rb
|
83
|
+
- lib/gruf/commander/request_validation_interceptor.rb
|
84
|
+
- lib/gruf/commander/version.rb
|
85
|
+
homepage: https://github.com/bigcommerce/gruf-commander
|
86
|
+
licenses: []
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.6.14
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Command/request syntax helper for gruf
|
108
|
+
test_files: []
|