webhookr 0.2.0 → 0.3.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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +1937 -0
  3. data/.travis.yml +8 -8
  4. data/Gemfile +12 -15
  5. data/Guardfile +12 -15
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +8 -7
  8. data/Rakefile +3 -3
  9. data/app/controllers/webhookr/events_controller.rb +23 -16
  10. data/config/routes.rb +9 -8
  11. data/lib/generators/webhookr/add_route_generator.rb +4 -4
  12. data/lib/generators/webhookr/init_generator.rb +14 -12
  13. data/lib/tasks/webhookr_tasks.rake +7 -7
  14. data/lib/webhookr.rb +13 -6
  15. data/lib/webhookr/adapter_response.rb +3 -1
  16. data/lib/webhookr/engine.rb +5 -4
  17. data/lib/webhookr/invalid_payload_error.rb +8 -2
  18. data/lib/webhookr/invalid_security_token_error.rb +3 -1
  19. data/lib/webhookr/invalid_service_name_error.rb +9 -0
  20. data/lib/webhookr/missing_callback_class_error.rb +9 -0
  21. data/lib/webhookr/ostruct_utils.rb +19 -19
  22. data/lib/webhookr/service.rb +28 -24
  23. data/lib/webhookr/services.rb +1 -1
  24. data/lib/webhookr/services/adapter.rb +1 -1
  25. data/lib/webhookr/services/adapter/base.rb +2 -2
  26. data/lib/webhookr/version.rb +3 -1
  27. data/test/dummy/Rakefile +0 -1
  28. data/test/dummy/app/controllers/application_controller.rb +2 -0
  29. data/test/dummy/app/helpers/application_helper.rb +2 -0
  30. data/test/dummy/config.ru +1 -1
  31. data/test/dummy/config/application.rb +8 -8
  32. data/test/dummy/config/boot.rb +4 -1
  33. data/test/dummy/config/environment.rb +2 -0
  34. data/test/dummy/config/environments/development.rb +2 -1
  35. data/test/dummy/config/environments/production.rb +2 -1
  36. data/test/dummy/config/environments/test.rb +5 -4
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +2 -0
  38. data/test/dummy/config/initializers/inflections.rb +2 -0
  39. data/test/dummy/config/initializers/mime_types.rb +2 -0
  40. data/test/dummy/config/initializers/secret_token.rb +3 -1
  41. data/test/dummy/config/initializers/session_store.rb +3 -1
  42. data/test/dummy/config/initializers/webhookr.rb +3 -1
  43. data/test/dummy/config/initializers/wrap_parameters.rb +3 -2
  44. data/test/dummy/config/routes.rb +3 -1
  45. data/test/dummy/script/rails +2 -2
  46. data/test/functional/webhookr/events_controller_test.rb +38 -42
  47. data/test/functional/webhookr/events_routes_test.rb +22 -15
  48. data/test/functional/webhookr/service_test.rb +53 -48
  49. data/test/integration/webhookr/add_route_generator_test.rb +5 -4
  50. data/test/integration/webhookr/init_generator_test.rb +7 -6
  51. data/test/stubs/service_under_test_stubs.rb +26 -33
  52. data/test/test_helper.rb +10 -9
  53. data/test/unit/webhookr/adapter_response_test.rb +7 -6
  54. data/test/unit/webhookr/ostruct_utils_test.rb +14 -14
  55. data/test/unit/webhookr/{Services/ServiceUnderTest → services/service_under_test}/adapter_test.rb +14 -14
  56. data/test/webhookr_test.rb +5 -3
  57. data/webhookr.gemspec +3 -4
  58. metadata +24 -27
@@ -1,39 +1,39 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
  require 'stubs/service_under_test_stubs'
3
5
 
4
6
  module Webhookr
5
7
  module Services
6
8
  class ServiceUnderTest::AdapterTest < ActiveSupport::TestCase
7
-
8
9
  def setup
9
- @event_type = "test_event"
10
- @data_msg = "Hello world!"
10
+ @event_type = 'test_event'
11
+ @data_msg = 'Hello world!'
11
12
  @valid_response = "event=#{@event_type}&data[msg]=#{@data_msg}"
12
- @invalid_response = "blort"
13
- end
13
+ @invalid_response = 'blort'
14
+ end
14
15
 
15
- test "should not raise an exception for a valid payload" do
16
- assert_nothing_raised {
16
+ test 'should not raise an exception for a valid payload' do
17
+ assert_nothing_raised do
17
18
  Webhookr::ServiceUnderTest::Adapter.process(@valid_response)
18
- }
19
+ end
19
20
  end
20
21
 
21
- test "should raise an exception for a invalid payload" do
22
- assert_raise(Webhookr::InvalidPayloadError) {
22
+ test 'should raise an exception for a invalid payload' do
23
+ assert_raise(Webhookr::InvalidPayloadError) do
23
24
  Webhookr::ServiceUnderTest::Adapter.process(@invalid_response)
24
- }
25
+ end
25
26
  end
26
27
 
27
- test "should repond with the correct event" do
28
+ test 'should repond with the correct event' do
28
29
  responses = Webhookr::ServiceUnderTest::Adapter.process(@valid_response)
29
30
  assert_equal(@event_type, responses.first.event_type)
30
31
  end
31
32
 
32
- test "should respond with valid data" do
33
+ test 'should respond with valid data' do
33
34
  responses = Webhookr::ServiceUnderTest::Adapter.process(@valid_response)
34
35
  assert_equal(@data_msg, responses.first.data.msg)
35
36
  end
36
-
37
37
  end
38
38
  end
39
39
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class WebhookrTest < ActiveSupport::TestCase
4
- test "should have Webhookr configuration" do
6
+ test 'should have Webhookr configuration' do
5
7
  assert_kind_of Hash, Webhookr.config
6
8
  end
7
-
8
- test "should have a basic_auth hash" do
9
+
10
+ test 'should have a basic_auth hash' do
9
11
  assert_kind_of Hash, Webhookr.config.basic_auth
10
12
  end
11
13
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
 
3
2
  require File.expand_path('../lib/webhookr/version', __FILE__)
4
3
 
@@ -7,15 +6,15 @@ Gem::Specification.new do |s|
7
6
  s.version = Webhookr::VERSION
8
7
 
9
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
- s.authors = ["Gerry Power"]
11
- s.email = ["code@zoocasa.com"]
9
+ s.authors = ["J Smith"]
10
+ s.email = ["dark.panda@gmail.com"]
12
11
  s.description = "Webhookr - easily and securely add webhooks to your Rails app."
13
12
  s.summary = s.description
14
13
 
15
14
  s.files = `git ls-files`.split($\)
16
15
  s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
- s.homepage = "http://github.com/zoocasa/webhookr"
17
+ s.homepage = "http://github.com/dark-panda/webhookr"
19
18
  s.require_paths = ["lib"]
20
19
 
21
20
  s.add_dependency "rails", [">= 3.1"]
metadata CHANGED
@@ -1,58 +1,54 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webhookr
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.0
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
- - Gerry Power
7
+ - J Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-02 00:00:00.000000000 Z
11
+ date: 2017-12-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
- type: :runtime
17
15
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
16
  requirements:
20
- - - ! '>='
17
+ - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: '3.1'
20
+ type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.1'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: securecompare
32
- type: :runtime
33
29
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
30
  requirements:
36
- - - ! '>='
31
+ - - ">="
37
32
  - !ruby/object:Gem::Version
38
33
  version: '0'
34
+ type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: Webhookr - easily and securely add webhooks to your Rails app.
47
42
  email:
48
- - code@zoocasa.com
43
+ - dark.panda@gmail.com
49
44
  executables: []
50
45
  extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
- - .coveralls.yml
54
- - .gitignore
55
- - .travis.yml
48
+ - ".coveralls.yml"
49
+ - ".gitignore"
50
+ - ".rubocop.yml"
51
+ - ".travis.yml"
56
52
  - Gemfile
57
53
  - Guardfile
58
54
  - MIT-LICENSE
@@ -68,6 +64,8 @@ files:
68
64
  - lib/webhookr/engine.rb
69
65
  - lib/webhookr/invalid_payload_error.rb
70
66
  - lib/webhookr/invalid_security_token_error.rb
67
+ - lib/webhookr/invalid_service_name_error.rb
68
+ - lib/webhookr/missing_callback_class_error.rb
71
69
  - lib/webhookr/ostruct_utils.rb
72
70
  - lib/webhookr/service.rb
73
71
  - lib/webhookr/services.rb
@@ -114,34 +112,33 @@ files:
114
112
  - test/integration/webhookr/init_generator_test.rb
115
113
  - test/stubs/service_under_test_stubs.rb
116
114
  - test/test_helper.rb
117
- - test/unit/webhookr/Services/ServiceUnderTest/adapter_test.rb
118
115
  - test/unit/webhookr/adapter_response_test.rb
119
116
  - test/unit/webhookr/ostruct_utils_test.rb
117
+ - test/unit/webhookr/services/service_under_test/adapter_test.rb
120
118
  - test/webhookr_test.rb
121
119
  - webhookr.gemspec
122
- homepage: http://github.com/zoocasa/webhookr
120
+ homepage: http://github.com/dark-panda/webhookr
123
121
  licenses: []
122
+ metadata: {}
124
123
  post_install_message:
125
124
  rdoc_options: []
126
125
  require_paths:
127
126
  - lib
128
127
  required_ruby_version: !ruby/object:Gem::Requirement
129
- none: false
130
128
  requirements:
131
- - - ! '>='
129
+ - - ">="
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
134
132
  required_rubygems_version: !ruby/object:Gem::Requirement
135
- none: false
136
133
  requirements:
137
- - - ! '>='
134
+ - - ">="
138
135
  - !ruby/object:Gem::Version
139
136
  version: '0'
140
137
  requirements: []
141
138
  rubyforge_project:
142
- rubygems_version: 1.8.23
139
+ rubygems_version: 2.6.13
143
140
  signing_key:
144
- specification_version: 3
141
+ specification_version: 4
145
142
  summary: Webhookr - easily and securely add webhooks to your Rails app.
146
143
  test_files:
147
144
  - test/dummy/README.rdoc
@@ -183,7 +180,7 @@ test_files:
183
180
  - test/integration/webhookr/init_generator_test.rb
184
181
  - test/stubs/service_under_test_stubs.rb
185
182
  - test/test_helper.rb
186
- - test/unit/webhookr/Services/ServiceUnderTest/adapter_test.rb
187
183
  - test/unit/webhookr/adapter_response_test.rb
188
184
  - test/unit/webhookr/ostruct_utils_test.rb
185
+ - test/unit/webhookr/services/service_under_test/adapter_test.rb
189
186
  - test/webhookr_test.rb