chatwork_webhook_verify 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +79 -0
  4. data/Rakefile +19 -0
  5. data/lib/chatwork_webhook_verify.rb +54 -0
  6. data/lib/chatwork_webhook_verify/configuration.rb +6 -0
  7. data/lib/chatwork_webhook_verify/controller_extension.rb +16 -0
  8. data/lib/chatwork_webhook_verify/railtie.rb +10 -0
  9. data/lib/chatwork_webhook_verify/version.rb +3 -0
  10. data/spec/chatwork_webhook_verify/controller_extension_spec.rb +37 -0
  11. data/spec/chatwork_webhook_verify_spec.rb +40 -0
  12. data/spec/dummy/Rakefile +6 -0
  13. data/spec/dummy/app/assets/config/manifest.js +1 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  17. data/spec/dummy/app/controllers/webhook_controller.rb +7 -0
  18. data/spec/dummy/app/jobs/application_job.rb +2 -0
  19. data/spec/dummy/bin/bundle +3 -0
  20. data/spec/dummy/bin/rails +4 -0
  21. data/spec/dummy/bin/rake +4 -0
  22. data/spec/dummy/bin/setup +25 -0
  23. data/spec/dummy/bin/update +25 -0
  24. data/spec/dummy/config.ru +5 -0
  25. data/spec/dummy/config/application.rb +35 -0
  26. data/spec/dummy/config/boot.rb +5 -0
  27. data/spec/dummy/config/environment.rb +5 -0
  28. data/spec/dummy/config/environments/development.rb +40 -0
  29. data/spec/dummy/config/environments/production.rb +68 -0
  30. data/spec/dummy/config/environments/test.rb +36 -0
  31. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  32. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/spec/dummy/config/initializers/cors.rb +16 -0
  34. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  35. data/spec/dummy/config/initializers/inflections.rb +16 -0
  36. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  37. data/spec/dummy/config/initializers/wrap_parameters.rb +9 -0
  38. data/spec/dummy/config/locales/en.yml +33 -0
  39. data/spec/dummy/config/puma.rb +56 -0
  40. data/spec/dummy/config/routes.rb +3 -0
  41. data/spec/dummy/config/secrets.yml +2 -0
  42. data/spec/dummy/config/spring.rb +6 -0
  43. data/spec/dummy/log/development.log +0 -0
  44. data/spec/dummy/log/test.log +122 -0
  45. data/spec/rails_helper.rb +45 -0
  46. data/spec/spec_helper.rb +114 -0
  47. metadata +252 -0
@@ -0,0 +1,45 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ # Prevent database truncation if the environment is production
6
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
7
+ require 'rspec/rails'
8
+ # Add additional requires below this line. Rails is not loaded until this point!
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc, in
11
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
+ # run as spec files by default. This means that files in spec/support that end
13
+ # in _spec.rb will both be required and run as specs, causing the specs to be
14
+ # run twice. It is recommended that you do not name files matching this glob to
15
+ # end with _spec.rb. You can configure this pattern with the --pattern
16
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17
+ #
18
+ # The following line is provided for convenience purposes. It has the downside
19
+ # of increasing the boot-up time by auto-requiring all files in the support
20
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
+ # require only the support files necessary.
22
+ #
23
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24
+
25
+ RSpec.configure do |config|
26
+ # RSpec Rails can automatically mix in different behaviours to your tests
27
+ # based on their file location, for example enabling you to call `get` and
28
+ # `post` in specs under `spec/controllers`.
29
+ #
30
+ # You can disable this behaviour by removing the line below, and instead
31
+ # explicitly tag your specs with their type, e.g.:
32
+ #
33
+ # RSpec.describe UsersController, :type => :controller do
34
+ # # ...
35
+ # end
36
+ #
37
+ # The different available types are documented in the features, such as in
38
+ # https://relishapp.com/rspec/rspec-rails/docs
39
+ config.infer_spec_type_from_file_location!
40
+
41
+ # Filter lines from Rails gems in backtraces.
42
+ config.filter_rails_from_backtrace!
43
+ # arbitrary gems may also be filtered via:
44
+ # config.filter_gems_from_backtrace("gem name")
45
+ end
@@ -0,0 +1,114 @@
1
+ if ENV["CI"]
2
+ require "simplecov"
3
+ require "coveralls"
4
+
5
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
6
+ SimpleCov.start do
7
+ %w[spec].each do |ignore_path|
8
+ add_filter(ignore_path)
9
+ end
10
+ end
11
+ end
12
+
13
+ require "bundler/setup"
14
+ require "chatwork_webhook_verify"
15
+ require "rspec/its"
16
+
17
+ Dir["#{__dir__}/support/**/*.rb"].each { |f| require f }
18
+
19
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
20
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
21
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
22
+ # this file to always be loaded, without a need to explicitly require it in any
23
+ # files.
24
+ #
25
+ # Given that it is always loaded, you are encouraged to keep this file as
26
+ # light-weight as possible. Requiring heavyweight dependencies from this file
27
+ # will add to the boot time of your test suite on EVERY test run, even for an
28
+ # individual file that may not need all of that loaded. Instead, consider making
29
+ # a separate helper file that requires the additional dependencies and performs
30
+ # the additional setup, and require it from the spec files that actually need
31
+ # it.
32
+ #
33
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
34
+ RSpec.configure do |config|
35
+ # rspec-expectations config goes here. You can use an alternate
36
+ # assertion/expectation library such as wrong or the stdlib/minitest
37
+ # assertions if you prefer.
38
+ config.expect_with :rspec do |expectations|
39
+ # This option will default to `true` in RSpec 4. It makes the `description`
40
+ # and `failure_message` of custom matchers include text for helper methods
41
+ # defined using `chain`, e.g.:
42
+ # be_bigger_than(2).and_smaller_than(4).description
43
+ # # => "be bigger than 2 and smaller than 4"
44
+ # ...rather than:
45
+ # # => "be bigger than 2"
46
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
47
+ end
48
+
49
+ # rspec-mocks config goes here. You can use an alternate test double
50
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
51
+ config.mock_with :rspec do |mocks|
52
+ # Prevents you from mocking or stubbing a method that does not exist on
53
+ # a real object. This is generally recommended, and will default to
54
+ # `true` in RSpec 4.
55
+ mocks.verify_partial_doubles = true
56
+ end
57
+
58
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
59
+ # have no way to turn it off -- the option exists only for backwards
60
+ # compatibility in RSpec 3). It causes shared context metadata to be
61
+ # inherited by the metadata hash of host groups and examples, rather than
62
+ # triggering implicit auto-inclusion in groups with matching metadata.
63
+ config.shared_context_metadata_behavior = :apply_to_host_groups
64
+
65
+ # The settings below are suggested to provide a good initial experience
66
+ # with RSpec, but feel free to customize to your heart's content.
67
+ =begin
68
+ # This allows you to limit a spec run to individual examples or groups
69
+ # you care about by tagging them with `:focus` metadata. When nothing
70
+ # is tagged with `:focus`, all examples get run. RSpec also provides
71
+ # aliases for `it`, `describe`, and `context` that include `:focus`
72
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
73
+ config.filter_run_when_matching :focus
74
+
75
+ # Allows RSpec to persist some state between runs in order to support
76
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
77
+ # you configure your source control system to ignore this file.
78
+ config.example_status_persistence_file_path = "spec/examples.txt"
79
+
80
+ # Limits the available syntax to the non-monkey patched syntax that is
81
+ # recommended. For more details, see:
82
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
83
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
84
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
85
+ config.disable_monkey_patching!
86
+
87
+ # Many RSpec users commonly either run the entire suite or an individual
88
+ # file, and it's useful to allow more verbose output when running an
89
+ # individual spec file.
90
+ if config.files_to_run.one?
91
+ # Use the documentation formatter for detailed output,
92
+ # unless a formatter has already been configured
93
+ # (e.g. via a command-line flag).
94
+ config.default_formatter = "doc"
95
+ end
96
+
97
+ # Print the 10 slowest examples and example groups at the
98
+ # end of the spec run, to help surface which specs are running
99
+ # particularly slow.
100
+ config.profile_examples = 10
101
+
102
+ # Run specs in random order to surface order dependencies. If you find an
103
+ # order dependency and want to debug it, you can fix the order by providing
104
+ # the seed, which is printed after each run.
105
+ # --seed 1234
106
+ config.order = :random
107
+
108
+ # Seed global randomization in this process using the `--seed` CLI option.
109
+ # Setting this allows you to use `--seed` to deterministically reproduce
110
+ # test failures related to randomization by passing the same `--seed` value
111
+ # as the one that triggered the failure.
112
+ Kernel.srand config.seed
113
+ =end
114
+ end
metadata ADDED
@@ -0,0 +1,252 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chatwork_webhook_verify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sue445
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionpack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: codeclimate-test-reporter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: railties
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: yard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Verify ChatWork webhook signature
140
+ email:
141
+ - sue445@sue445.net
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - MIT-LICENSE
147
+ - README.md
148
+ - Rakefile
149
+ - lib/chatwork_webhook_verify.rb
150
+ - lib/chatwork_webhook_verify/configuration.rb
151
+ - lib/chatwork_webhook_verify/controller_extension.rb
152
+ - lib/chatwork_webhook_verify/railtie.rb
153
+ - lib/chatwork_webhook_verify/version.rb
154
+ - spec/chatwork_webhook_verify/controller_extension_spec.rb
155
+ - spec/chatwork_webhook_verify_spec.rb
156
+ - spec/dummy/Rakefile
157
+ - spec/dummy/app/assets/config/manifest.js
158
+ - spec/dummy/app/assets/javascripts/application.js
159
+ - spec/dummy/app/assets/stylesheets/application.css
160
+ - spec/dummy/app/controllers/application_controller.rb
161
+ - spec/dummy/app/controllers/webhook_controller.rb
162
+ - spec/dummy/app/jobs/application_job.rb
163
+ - spec/dummy/bin/bundle
164
+ - spec/dummy/bin/rails
165
+ - spec/dummy/bin/rake
166
+ - spec/dummy/bin/setup
167
+ - spec/dummy/bin/update
168
+ - spec/dummy/config.ru
169
+ - spec/dummy/config/application.rb
170
+ - spec/dummy/config/boot.rb
171
+ - spec/dummy/config/environment.rb
172
+ - spec/dummy/config/environments/development.rb
173
+ - spec/dummy/config/environments/production.rb
174
+ - spec/dummy/config/environments/test.rb
175
+ - spec/dummy/config/initializers/application_controller_renderer.rb
176
+ - spec/dummy/config/initializers/backtrace_silencers.rb
177
+ - spec/dummy/config/initializers/cors.rb
178
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
179
+ - spec/dummy/config/initializers/inflections.rb
180
+ - spec/dummy/config/initializers/mime_types.rb
181
+ - spec/dummy/config/initializers/wrap_parameters.rb
182
+ - spec/dummy/config/locales/en.yml
183
+ - spec/dummy/config/puma.rb
184
+ - spec/dummy/config/routes.rb
185
+ - spec/dummy/config/secrets.yml
186
+ - spec/dummy/config/spring.rb
187
+ - spec/dummy/log/development.log
188
+ - spec/dummy/log/test.log
189
+ - spec/rails_helper.rb
190
+ - spec/spec_helper.rb
191
+ homepage: https://github.com/sue445/chatwork_webhook_verify
192
+ licenses:
193
+ - MIT
194
+ metadata: {}
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 2.7.4
212
+ signing_key:
213
+ specification_version: 4
214
+ summary: Verify ChatWork webhook signature
215
+ test_files:
216
+ - spec/chatwork_webhook_verify/controller_extension_spec.rb
217
+ - spec/chatwork_webhook_verify_spec.rb
218
+ - spec/dummy/app/assets/config/manifest.js
219
+ - spec/dummy/app/assets/javascripts/application.js
220
+ - spec/dummy/app/assets/stylesheets/application.css
221
+ - spec/dummy/app/controllers/application_controller.rb
222
+ - spec/dummy/app/controllers/webhook_controller.rb
223
+ - spec/dummy/app/jobs/application_job.rb
224
+ - spec/dummy/bin/bundle
225
+ - spec/dummy/bin/rails
226
+ - spec/dummy/bin/rake
227
+ - spec/dummy/bin/setup
228
+ - spec/dummy/bin/update
229
+ - spec/dummy/config/application.rb
230
+ - spec/dummy/config/boot.rb
231
+ - spec/dummy/config/environment.rb
232
+ - spec/dummy/config/environments/development.rb
233
+ - spec/dummy/config/environments/production.rb
234
+ - spec/dummy/config/environments/test.rb
235
+ - spec/dummy/config/initializers/application_controller_renderer.rb
236
+ - spec/dummy/config/initializers/backtrace_silencers.rb
237
+ - spec/dummy/config/initializers/cors.rb
238
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
239
+ - spec/dummy/config/initializers/inflections.rb
240
+ - spec/dummy/config/initializers/mime_types.rb
241
+ - spec/dummy/config/initializers/wrap_parameters.rb
242
+ - spec/dummy/config/locales/en.yml
243
+ - spec/dummy/config/puma.rb
244
+ - spec/dummy/config/routes.rb
245
+ - spec/dummy/config/secrets.yml
246
+ - spec/dummy/config/spring.rb
247
+ - spec/dummy/config.ru
248
+ - spec/dummy/log/development.log
249
+ - spec/dummy/log/test.log
250
+ - spec/dummy/Rakefile
251
+ - spec/rails_helper.rb
252
+ - spec/spec_helper.rb