solidus_webhooks 0.3.0 → 0.4.1
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 +4 -4
- data/.circleci/config.yml +40 -12
- data/.rubocop.yml +20 -3
- data/CHANGELOG.md +1 -36
- data/Gemfile +7 -1
- data/OLD_CHANGELOG.md +52 -0
- data/README.md +5 -11
- data/Rakefile +1 -0
- data/lib/solidus_webhooks/configuration.rb +18 -0
- data/lib/solidus_webhooks/version.rb +1 -1
- data/lib/solidus_webhooks.rb +0 -18
- data/solidus_webhooks.gemspec +4 -4
- data/spec/features/can_register_a_handler_and_receive_webhooks_spec.rb +11 -9
- data/spec/solidus_webhooks/configuration_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -3
- metadata +11 -12
- data/.rubocop_todo.yml +0 -107
- data/bin/sandbox_rails +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bbece9b61fc0efa4aff2ad40c3de393255be4a5c50a0f4b6fc70864eb136ed4c
|
|
4
|
+
data.tar.gz: af07e20e789d3d66983803fe91bd6bd5e3ae77119c4bc96333162f74eb39e786
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 349a87f5b58d62023bfb3ae61baf512ee674ffa1a3ba1fa04bc511a26039e07c792885ae732bf4a78999e9575fdd3a0a6e0e88edaf19f689eedf67b77fd433dc
|
|
7
|
+
data.tar.gz: 8b8b63754f026431e9033518affe8b97b8a23672e7ed39022221caf0d2e445097c8185c9a32a7a16cd52ce3bdb010ab39e32c28a21bb127fbfa5b6936b7f034d
|
data/.circleci/config.yml
CHANGED
|
@@ -8,24 +8,46 @@ orbs:
|
|
|
8
8
|
solidusio_extensions: solidusio/extensions@volatile
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
|
-
run-specs
|
|
12
|
-
|
|
11
|
+
run-specs:
|
|
12
|
+
parameters:
|
|
13
|
+
solidus:
|
|
14
|
+
type: string
|
|
15
|
+
default: master
|
|
16
|
+
db:
|
|
17
|
+
type: string
|
|
18
|
+
default: "postgres"
|
|
19
|
+
ruby:
|
|
20
|
+
type: string
|
|
21
|
+
default: "3.2"
|
|
22
|
+
executor:
|
|
23
|
+
name: solidusio_extensions/<< parameters.db >>
|
|
24
|
+
ruby_version: << parameters.ruby >>
|
|
13
25
|
steps:
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- solidusio_extensions/run-tests
|
|
26
|
+
- checkout
|
|
27
|
+
- solidusio_extensions/run-tests-solidus-<< parameters.solidus >>
|
|
28
|
+
|
|
19
29
|
lint-code:
|
|
20
|
-
executor:
|
|
30
|
+
executor:
|
|
31
|
+
name: solidusio_extensions/sqlite
|
|
32
|
+
ruby_version: "3.0"
|
|
21
33
|
steps:
|
|
22
34
|
- solidusio_extensions/lint-code
|
|
23
35
|
|
|
24
36
|
workflows:
|
|
25
37
|
"Run specs on supported Solidus versions":
|
|
26
38
|
jobs:
|
|
27
|
-
- run-specs
|
|
28
|
-
|
|
39
|
+
- run-specs:
|
|
40
|
+
name: &name "run-specs-solidus-<< matrix.solidus >>-ruby-<< matrix.ruby >>-db-<< matrix.db >>"
|
|
41
|
+
matrix:
|
|
42
|
+
parameters: { solidus: ["master"], ruby: ["3.2"], db: ["postgres"] }
|
|
43
|
+
- run-specs:
|
|
44
|
+
name: *name
|
|
45
|
+
matrix:
|
|
46
|
+
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
|
|
47
|
+
- run-specs:
|
|
48
|
+
name: *name
|
|
49
|
+
matrix:
|
|
50
|
+
parameters: { solidus: ["older"], ruby: ["3.0"], db: ["sqlite"] }
|
|
29
51
|
- lint-code
|
|
30
52
|
|
|
31
53
|
"Weekly run specs against master":
|
|
@@ -37,5 +59,11 @@ workflows:
|
|
|
37
59
|
only:
|
|
38
60
|
- master
|
|
39
61
|
jobs:
|
|
40
|
-
- run-specs
|
|
41
|
-
|
|
62
|
+
- run-specs:
|
|
63
|
+
name: *name
|
|
64
|
+
matrix:
|
|
65
|
+
parameters: { solidus: ["master"], ruby: ["3.2"], db: ["postgres"] }
|
|
66
|
+
- run-specs:
|
|
67
|
+
name: *name
|
|
68
|
+
matrix:
|
|
69
|
+
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
|
data/.rubocop.yml
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
|
2
|
-
|
|
3
1
|
require:
|
|
4
2
|
- solidus_dev_support/rubocop
|
|
5
3
|
|
|
6
4
|
AllCops:
|
|
7
|
-
NewCops:
|
|
5
|
+
NewCops: disable
|
|
8
6
|
Exclude:
|
|
9
7
|
- sandbox/**/*
|
|
10
8
|
- spec/dummy/**/*
|
|
11
9
|
- vendor/bundle/**/*
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# This guys are troublemakers
|
|
13
|
+
RSpec/FactoryBot/CreateList:
|
|
14
|
+
Enabled: false
|
|
15
|
+
RSpec/Rails/HttpStatus:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
# Deviations from the standard
|
|
19
|
+
Style/ClassAndModuleChildren:
|
|
20
|
+
Enabled: false
|
|
21
|
+
Style/FrozenStringLiteralComment:
|
|
22
|
+
Enabled: false
|
|
23
|
+
RSpec/Capybara/FeatureMethods:
|
|
24
|
+
Enabled: false
|
|
25
|
+
RSpec/MultipleExpectations:
|
|
26
|
+
Enabled: false
|
|
27
|
+
RSpec/NamedSubject:
|
|
28
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,38 +1,3 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.2.0...v0.3.0)
|
|
6
|
-
|
|
7
|
-
**Fixed bugs:**
|
|
8
|
-
|
|
9
|
-
- Fix error classes [\#5](https://github.com/solidusio-contrib/solidus_webhooks/pull/5) ([elia](https://github.com/elia))
|
|
10
|
-
|
|
11
|
-
## [v0.2.0](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.2.0) (2020-06-10)
|
|
12
|
-
|
|
13
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.1.0...v0.2.0)
|
|
14
|
-
|
|
15
|
-
**Implemented enhancements:**
|
|
16
|
-
|
|
17
|
-
- Expose current\_api\_user to webhook handlers [\#4](https://github.com/solidusio-contrib/solidus_webhooks/pull/4) ([elia](https://github.com/elia))
|
|
18
|
-
|
|
19
|
-
## [v0.1.0](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.1.0) (2020-05-14)
|
|
20
|
-
|
|
21
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.1.0.beta.1...v0.1.0)
|
|
22
|
-
|
|
23
|
-
## [v0.1.0.beta.1](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.1.0.beta.1) (2020-05-13)
|
|
24
|
-
|
|
25
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.0.1.v0.1.0.beta.1.1...v0.1.0.beta.1)
|
|
26
|
-
|
|
27
|
-
## [v0.0.1.v0.1.0.beta.1.1](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.0.1.v0.1.0.beta.1.1) (2020-05-13)
|
|
28
|
-
|
|
29
|
-
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/9573caa400232ffb44cde7f8cf907171a529ced3...v0.0.1.v0.1.0.beta.1.1)
|
|
30
|
-
|
|
31
|
-
**Merged pull requests:**
|
|
32
|
-
|
|
33
|
-
- Prepare the repo to be moved to @solidusio-contrib [\#2](https://github.com/solidusio-contrib/solidus_webhooks/pull/2) ([elia](https://github.com/elia))
|
|
34
|
-
- Add the ability to register and receive webhooks [\#1](https://github.com/solidusio-contrib/solidus_webhooks/pull/1) ([elia](https://github.com/elia))
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
|
3
|
+
See https://github.com/solidusio-contrib/solidus_webhooks/releases or [OLD_CHANGELOG.md](OLD_CHANGELOG.md) for older versions.
|
data/Gemfile
CHANGED
|
@@ -4,7 +4,13 @@ source 'https://rubygems.org'
|
|
|
4
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
5
5
|
|
|
6
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
|
7
|
-
|
|
7
|
+
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
|
|
8
|
+
%w[solidusio/solidus solidusio/solidus_frontend]
|
|
9
|
+
else
|
|
10
|
+
%w[solidusio/solidus] * 2
|
|
11
|
+
end
|
|
12
|
+
gem 'solidus', github: solidus_git, branch: branch
|
|
13
|
+
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
|
|
8
14
|
|
|
9
15
|
# Needed to help Bundler figure out how to resolve dependencies,
|
|
10
16
|
# otherwise it takes forever to resolve them.
|
data/OLD_CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v0.3.0](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.3.0) (2021-04-20)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.3.0...v0.3.0)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- Prepare Solidus Webhooks for Solidus 3.0 [\#8](https://github.com/solidusio-contrib/solidus_webhooks/issues/8)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Allow Solidus 3 [\#10](https://github.com/solidusio-contrib/solidus_webhooks/pull/10) ([kennyadsl](https://github.com/kennyadsl))
|
|
14
|
+
- Reconcile master and v0.3.0 [\#7](https://github.com/solidusio-contrib/solidus_webhooks/pull/7) ([elia](https://github.com/elia))
|
|
15
|
+
- Bump solidus\_support to ~\> 0.6 [\#6](https://github.com/solidusio-contrib/solidus_webhooks/pull/6) ([peterberkenbosch](https://github.com/peterberkenbosch))
|
|
16
|
+
|
|
17
|
+
## [v0.3.0](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.3.0) (2020-10-20)
|
|
18
|
+
|
|
19
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.2.0...v0.3.0)
|
|
20
|
+
|
|
21
|
+
**Fixed bugs:**
|
|
22
|
+
|
|
23
|
+
- Fix error classes [\#5](https://github.com/solidusio-contrib/solidus_webhooks/pull/5) ([elia](https://github.com/elia))
|
|
24
|
+
|
|
25
|
+
## [v0.2.0](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.2.0) (2020-06-10)
|
|
26
|
+
|
|
27
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.1.0...v0.2.0)
|
|
28
|
+
|
|
29
|
+
**Implemented enhancements:**
|
|
30
|
+
|
|
31
|
+
- Expose current\_api\_user to webhook handlers [\#4](https://github.com/solidusio-contrib/solidus_webhooks/pull/4) ([elia](https://github.com/elia))
|
|
32
|
+
|
|
33
|
+
## [v0.1.0](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.1.0) (2020-05-14)
|
|
34
|
+
|
|
35
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.1.0.beta.1...v0.1.0)
|
|
36
|
+
|
|
37
|
+
## [v0.1.0.beta.1](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.1.0.beta.1) (2020-05-13)
|
|
38
|
+
|
|
39
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/v0.0.1.v0.1.0.beta.1.1...v0.1.0.beta.1)
|
|
40
|
+
|
|
41
|
+
## [v0.0.1.v0.1.0.beta.1.1](https://github.com/solidusio-contrib/solidus_webhooks/tree/v0.0.1.v0.1.0.beta.1.1) (2020-05-13)
|
|
42
|
+
|
|
43
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_webhooks/compare/9573caa400232ffb44cde7f8cf907171a529ced3...v0.0.1.v0.1.0.beta.1.1)
|
|
44
|
+
|
|
45
|
+
**Merged pull requests:**
|
|
46
|
+
|
|
47
|
+
- Prepare the repo to be moved to @solidusio-contrib [\#2](https://github.com/solidusio-contrib/solidus_webhooks/pull/2) ([elia](https://github.com/elia))
|
|
48
|
+
- Add the ability to register and receive webhooks [\#1](https://github.com/solidusio-contrib/solidus_webhooks/pull/1) ([elia](https://github.com/elia))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
[](https://circleci.com/gh/solidusio-contrib/solidus_webhooks)
|
|
4
4
|
[](https://codecov.io/gh/solidusio-contrib/solidus_webhooks)
|
|
5
5
|
|
|
6
|
+
<!-- Explain what your extension does. -->
|
|
7
|
+
|
|
6
8
|
## Installation
|
|
7
9
|
|
|
8
10
|
Add solidus_webhooks to your Gemfile:
|
|
@@ -19,6 +21,8 @@ bin/rails generate solidus_webhooks:install
|
|
|
19
21
|
|
|
20
22
|
## Usage
|
|
21
23
|
|
|
24
|
+
<!-- Explain how to use your extension once it's been installed. -->
|
|
25
|
+
|
|
22
26
|
A Webhook receiver is just a callable and can be registered in the Solidus configuration as follows:
|
|
23
27
|
|
|
24
28
|
```ruby
|
|
@@ -188,17 +192,7 @@ git commit -m "Update the changelog"
|
|
|
188
192
|
|
|
189
193
|
### Releasing new versions
|
|
190
194
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
```shell
|
|
194
|
-
bundle exec gem bump -v 1.6.0
|
|
195
|
-
bin/rake changelog
|
|
196
|
-
git add CHANGELOG.md
|
|
197
|
-
git commit --amend --no-edit
|
|
198
|
-
gem tag
|
|
199
|
-
git push --tags
|
|
200
|
-
bundle exec gem release
|
|
201
|
-
```
|
|
195
|
+
Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.
|
|
202
196
|
|
|
203
197
|
## License
|
|
204
198
|
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'solidus_webhooks/errors'
|
|
2
4
|
|
|
3
5
|
module SolidusWebhooks
|
|
@@ -19,4 +21,20 @@ module SolidusWebhooks
|
|
|
19
21
|
@handlers[id.to_sym]
|
|
20
22
|
end
|
|
21
23
|
end
|
|
24
|
+
|
|
25
|
+
class << self
|
|
26
|
+
def configuration
|
|
27
|
+
@configuration ||= Configuration.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
alias config configuration
|
|
31
|
+
|
|
32
|
+
def reset_config!
|
|
33
|
+
@configuration = nil
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def configure
|
|
37
|
+
yield configuration
|
|
38
|
+
end
|
|
39
|
+
end
|
|
22
40
|
end
|
data/lib/solidus_webhooks.rb
CHANGED
|
@@ -6,21 +6,3 @@ require 'solidus_support'
|
|
|
6
6
|
require 'solidus_webhooks/configuration'
|
|
7
7
|
require 'solidus_webhooks/version'
|
|
8
8
|
require 'solidus_webhooks/engine'
|
|
9
|
-
|
|
10
|
-
module SolidusWebhooks
|
|
11
|
-
class << self
|
|
12
|
-
def configuration
|
|
13
|
-
@configuration ||= Configuration.new
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
alias config configuration
|
|
17
|
-
|
|
18
|
-
def reset_config!
|
|
19
|
-
@configuration = nil
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def configure
|
|
23
|
-
yield configuration
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
data/solidus_webhooks.gemspec
CHANGED
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
spec.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_webhooks'
|
|
17
17
|
spec.metadata['changelog_uri'] = 'https://github.com/solidusio-contrib/solidus_webhooks/releases'
|
|
18
18
|
|
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new('
|
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
|
|
20
20
|
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
29
29
|
spec.require_paths = ["lib"]
|
|
30
30
|
|
|
31
|
-
spec.add_dependency 'solidus_core', ['>= 2.0.0', '<
|
|
32
|
-
spec.add_dependency 'solidus_support', '~> 0.
|
|
31
|
+
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 5']
|
|
32
|
+
spec.add_dependency 'solidus_support', '~> 0.6'
|
|
33
33
|
|
|
34
|
-
spec.add_development_dependency 'solidus_dev_support', '~> 2.
|
|
34
|
+
spec.add_development_dependency 'solidus_dev_support', '~> 2.2'
|
|
35
35
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
+
# rubocop:disable RSpec/MultipleMemoizedHelpers
|
|
3
4
|
RSpec.feature "Can register a handler and receive Webhooks", type: :request do
|
|
4
5
|
background do
|
|
5
6
|
SolidusWebhooks.config.register_webhook_handler :proc, proc_handler
|
|
@@ -16,14 +17,14 @@ RSpec.feature "Can register a handler and receive Webhooks", type: :request do
|
|
|
16
17
|
let(:method_and_user_payloads) { [] }
|
|
17
18
|
|
|
18
19
|
let(:proc_handler) { ->(payload) { proc_payloads << payload } }
|
|
19
|
-
let(:method_handler) {
|
|
20
|
-
def call(payload) payloads << payload end
|
|
21
|
-
|
|
20
|
+
let(:method_handler) {
|
|
21
|
+
Struct.new(:payloads) { def call(payload) payloads << payload end }.new(method_payloads)
|
|
22
|
+
}
|
|
22
23
|
let(:user_handler) { ->(payload, user) { user_payloads << [payload, user] } }
|
|
23
24
|
let(:splat_handler) { ->(*args) { splat_payloads << args } }
|
|
24
|
-
let(:method_and_user_handler) {
|
|
25
|
-
def call(payload, user) payloads << payload end
|
|
26
|
-
|
|
25
|
+
let(:method_and_user_handler) {
|
|
26
|
+
Struct.new(:payloads) { def call(payload, user) payloads << [payload, user] end }.new(method_and_user_payloads)
|
|
27
|
+
}
|
|
27
28
|
|
|
28
29
|
let(:authorized_user) { create(:admin_user, spree_api_key: "123") }
|
|
29
30
|
let(:authorized_token) { authorized_user.spree_api_key }
|
|
@@ -41,7 +42,7 @@ RSpec.feature "Can register a handler and receive Webhooks", type: :request do
|
|
|
41
42
|
post "/webhooks/method?token=#{authorized_token}", as: :json, params: { c: 789 }
|
|
42
43
|
expect(response).to have_http_status(:ok)
|
|
43
44
|
|
|
44
|
-
post "/webhooks/user?token=#{authorized_token}", as: :json, params: { d:
|
|
45
|
+
post "/webhooks/user?token=#{authorized_token}", as: :json, params: { d: 12 }
|
|
45
46
|
expect(response).to have_http_status(:ok)
|
|
46
47
|
|
|
47
48
|
post "/webhooks/splat?token=#{authorized_token}", as: :json, params: { e: 345 }
|
|
@@ -52,9 +53,9 @@ RSpec.feature "Can register a handler and receive Webhooks", type: :request do
|
|
|
52
53
|
|
|
53
54
|
expect(proc_payloads).to eq([{ 'a' => 123 }, { 'b' => 456 }])
|
|
54
55
|
expect(method_payloads).to eq([{ 'c' => 789 }])
|
|
55
|
-
expect(user_payloads).to eq([[{ 'd' =>
|
|
56
|
+
expect(user_payloads).to eq([[{ 'd' => 12 }, authorized_user]])
|
|
56
57
|
expect(splat_payloads).to eq([[{ 'e' => 345 }, authorized_user]])
|
|
57
|
-
expect(method_and_user_payloads).to eq([{ 'f' => 678 }])
|
|
58
|
+
expect(method_and_user_payloads).to eq([[{ 'f' => 678 }, authorized_user]])
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
scenario "receives a bad handler id" do
|
|
@@ -72,3 +73,4 @@ RSpec.feature "Can register a handler and receive Webhooks", type: :request do
|
|
|
72
73
|
expect(response).to have_http_status(:unauthorized)
|
|
73
74
|
end
|
|
74
75
|
end
|
|
76
|
+
# rubocop:enable RSpec/MultipleMemoizedHelpers
|
|
@@ -4,7 +4,7 @@ RSpec.describe SolidusWebhooks::Configuration do
|
|
|
4
4
|
describe '#register_webhook_handler' do
|
|
5
5
|
it 'only accepts callable' do
|
|
6
6
|
expect{ subject.register_webhook_handler(:foo, Object.new) }.to raise_error(SolidusWebhooks::InvalidHandler)
|
|
7
|
-
expect{ subject.register_webhook_handler(:bar,
|
|
7
|
+
expect{ subject.register_webhook_handler(:bar, proc {}) }.not_to raise_error
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -14,13 +14,12 @@ require dummy_env
|
|
|
14
14
|
# Requires factories and other useful helpers defined in spree_core.
|
|
15
15
|
require 'solidus_dev_support/rspec/feature_helper'
|
|
16
16
|
|
|
17
|
+
SolidusDevSupport::TestingSupport::Factories.load_for(SolidusWebhooks::Engine, Spree::Auth::Engine)
|
|
18
|
+
|
|
17
19
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
18
20
|
# in spec/support/ and its subdirectories.
|
|
19
21
|
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
|
20
22
|
|
|
21
|
-
# Requires factories defined in lib/solidus_webhooks/testing_support/factories.rb
|
|
22
|
-
require 'solidus_webhooks/testing_support/factories'
|
|
23
|
-
|
|
24
23
|
RSpec.configure do |config|
|
|
25
24
|
config.infer_spec_type_from_file_location!
|
|
26
25
|
config.use_transactional_fixtures = false
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_webhooks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elia Schito
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: solidus_core
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: 2.0.0
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '5'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,35 +29,35 @@ dependencies:
|
|
|
29
29
|
version: 2.0.0
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '5'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: solidus_support
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0.
|
|
39
|
+
version: '0.6'
|
|
40
40
|
type: :runtime
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0.
|
|
46
|
+
version: '0.6'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: solidus_dev_support
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '2.
|
|
53
|
+
version: '2.2'
|
|
54
54
|
type: :development
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '2.
|
|
60
|
+
version: '2.2'
|
|
61
61
|
description:
|
|
62
62
|
email: contact@solidus.io
|
|
63
63
|
executables: []
|
|
@@ -71,10 +71,10 @@ files:
|
|
|
71
71
|
- ".gitignore"
|
|
72
72
|
- ".rspec"
|
|
73
73
|
- ".rubocop.yml"
|
|
74
|
-
- ".rubocop_todo.yml"
|
|
75
74
|
- CHANGELOG.md
|
|
76
75
|
- Gemfile
|
|
77
76
|
- LICENSE
|
|
77
|
+
- OLD_CHANGELOG.md
|
|
78
78
|
- README.md
|
|
79
79
|
- Rakefile
|
|
80
80
|
- app/assets/javascripts/spree/backend/solidus_webhooks.js
|
|
@@ -89,7 +89,6 @@ files:
|
|
|
89
89
|
- bin/rails-sandbox
|
|
90
90
|
- bin/rake
|
|
91
91
|
- bin/sandbox
|
|
92
|
-
- bin/sandbox_rails
|
|
93
92
|
- bin/setup
|
|
94
93
|
- config/locales/en.yml
|
|
95
94
|
- config/routes.rb
|
|
@@ -121,7 +120,7 @@ require_paths:
|
|
|
121
120
|
- lib
|
|
122
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
122
|
requirements:
|
|
124
|
-
- - "
|
|
123
|
+
- - ">="
|
|
125
124
|
- !ruby/object:Gem::Version
|
|
126
125
|
version: '2.5'
|
|
127
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
@@ -130,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
130
129
|
- !ruby/object:Gem::Version
|
|
131
130
|
version: '0'
|
|
132
131
|
requirements: []
|
|
133
|
-
rubygems_version: 3.
|
|
132
|
+
rubygems_version: 3.3.7
|
|
134
133
|
signing_key:
|
|
135
134
|
specification_version: 4
|
|
136
135
|
summary: Webhooks support for Solidus
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2020-10-19 16:38:34 UTC using RuboCop version 0.93.1.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 6
|
|
10
|
-
# Cop supports --auto-correct.
|
|
11
|
-
# Configuration parameters: EnabledMethods.
|
|
12
|
-
Capybara/FeatureMethods:
|
|
13
|
-
Exclude:
|
|
14
|
-
- 'spec/features/can_register_a_handler_and_receive_webhooks_spec.rb'
|
|
15
|
-
|
|
16
|
-
# Offense count: 2
|
|
17
|
-
# Cop supports --auto-correct.
|
|
18
|
-
Layout/BlockEndNewline:
|
|
19
|
-
Exclude:
|
|
20
|
-
- 'spec/features/can_register_a_handler_and_receive_webhooks_spec.rb'
|
|
21
|
-
|
|
22
|
-
# Offense count: 2
|
|
23
|
-
# Cop supports --auto-correct.
|
|
24
|
-
Layout/MultilineBlockLayout:
|
|
25
|
-
Exclude:
|
|
26
|
-
- 'spec/features/can_register_a_handler_and_receive_webhooks_spec.rb'
|
|
27
|
-
|
|
28
|
-
# Offense count: 2
|
|
29
|
-
# Cop supports --auto-correct.
|
|
30
|
-
# Configuration parameters: EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
|
31
|
-
# SupportedStyles: space, no_space
|
|
32
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
|
33
|
-
Layout/SpaceInsideBlockBraces:
|
|
34
|
-
EnforcedStyle: space
|
|
35
|
-
|
|
36
|
-
# Offense count: 30
|
|
37
|
-
# Cop supports --auto-correct.
|
|
38
|
-
# Configuration parameters: EnforcedStyleForEmptyBraces.
|
|
39
|
-
# SupportedStyles: space, no_space, compact
|
|
40
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
|
41
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
42
|
-
EnforcedStyle: space
|
|
43
|
-
|
|
44
|
-
# Offense count: 1
|
|
45
|
-
# Cop supports --auto-correct.
|
|
46
|
-
Lint/RedundantCopDisableDirective:
|
|
47
|
-
Exclude:
|
|
48
|
-
- 'bin/sandbox_rails'
|
|
49
|
-
|
|
50
|
-
# Offense count: 1
|
|
51
|
-
# Cop supports --auto-correct.
|
|
52
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
|
53
|
-
Lint/UnusedMethodArgument:
|
|
54
|
-
Exclude:
|
|
55
|
-
- 'spec/features/can_register_a_handler_and_receive_webhooks_spec.rb'
|
|
56
|
-
|
|
57
|
-
# Offense count: 3
|
|
58
|
-
RSpec/MultipleExpectations:
|
|
59
|
-
Max: 11
|
|
60
|
-
|
|
61
|
-
# Offense count: 1
|
|
62
|
-
# Configuration parameters: AllowSubject.
|
|
63
|
-
RSpec/MultipleMemoizedHelpers:
|
|
64
|
-
Max: 14
|
|
65
|
-
|
|
66
|
-
# Offense count: 2
|
|
67
|
-
# Configuration parameters: IgnoreSharedExamples.
|
|
68
|
-
RSpec/NamedSubject:
|
|
69
|
-
Exclude:
|
|
70
|
-
- 'spec/solidus_webhooks/configuration_spec.rb'
|
|
71
|
-
|
|
72
|
-
# Offense count: 2
|
|
73
|
-
# Cop supports --auto-correct.
|
|
74
|
-
# Configuration parameters: EnforcedStyle.
|
|
75
|
-
# SupportedStyles: nested, compact
|
|
76
|
-
Style/ClassAndModuleChildren:
|
|
77
|
-
Exclude:
|
|
78
|
-
- 'app/controllers/spree/webhooks_controller.rb'
|
|
79
|
-
- 'app/models/spree/webhook.rb'
|
|
80
|
-
|
|
81
|
-
# Offense count: 4
|
|
82
|
-
# Cop supports --auto-correct.
|
|
83
|
-
# Configuration parameters: EnforcedStyle.
|
|
84
|
-
# SupportedStyles: always, always_true, never
|
|
85
|
-
Style/FrozenStringLiteralComment:
|
|
86
|
-
Exclude:
|
|
87
|
-
- 'spec/**/*'
|
|
88
|
-
- 'db/migrate/**/*'
|
|
89
|
-
- 'bin/**/*'
|
|
90
|
-
- 'app/controllers/spree/webhooks_controller.rb'
|
|
91
|
-
- 'app/models/spree/webhook.rb'
|
|
92
|
-
- 'lib/solidus_webhooks/configuration.rb'
|
|
93
|
-
- 'lib/solidus_webhooks/errors.rb'
|
|
94
|
-
|
|
95
|
-
# Offense count: 2
|
|
96
|
-
# Cop supports --auto-correct.
|
|
97
|
-
# Configuration parameters: EnforcedOctalStyle.
|
|
98
|
-
# SupportedOctalStyles: zero_with_o, zero_only
|
|
99
|
-
Style/NumericLiteralPrefix:
|
|
100
|
-
Exclude:
|
|
101
|
-
- 'spec/features/can_register_a_handler_and_receive_webhooks_spec.rb'
|
|
102
|
-
|
|
103
|
-
# Offense count: 1
|
|
104
|
-
# Cop supports --auto-correct.
|
|
105
|
-
Style/Proc:
|
|
106
|
-
Exclude:
|
|
107
|
-
- 'spec/solidus_webhooks/configuration_spec.rb'
|
data/bin/sandbox_rails
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
# frozen_string_literal: true
|
|
4
|
-
|
|
5
|
-
app_root = 'sandbox'
|
|
6
|
-
|
|
7
|
-
unless File.exist? "#{app_root}/bin/rails"
|
|
8
|
-
warn 'Creating the sandbox app...'
|
|
9
|
-
Dir.chdir "#{__dir__}/.." do
|
|
10
|
-
system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
|
|
11
|
-
warn 'Automatic creation of the sandbox app failed'
|
|
12
|
-
exit 1
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
Dir.chdir app_root
|
|
18
|
-
exec 'bin/rails', *ARGV
|