stripe_webhooks 0.0.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd1f08430b1ef364a86da41ffb13052b5f817413
4
- data.tar.gz: a7d9e947785bcc9267cbade2ab1141a23f3a5e8b
3
+ metadata.gz: db9fc92d2726f727a3658c8c11de00784440a412
4
+ data.tar.gz: 41d70d0e78569b17bee76405aab05b340bad361c
5
5
  SHA512:
6
- metadata.gz: 9affb286ac0b56570d85ba2b30c30eb45e2c24229b7de964cd1af12246aba77d81f5e3424d8b6a51a18da11cf9370464a7743de8f7058d8d77f9d450e44c2eec
7
- data.tar.gz: 5d26da0418c121b1c124cdc507a8290886133adf48b59c2bc2eafdd3baffa8182bf159625684a33b290bba3bb390578015686c346e8229b26543c31aeb05d10a
6
+ metadata.gz: 4304d004d08aa941ff8941a6c29cfd1f2d50f03317923d2506c375a75a79701cd3607a45c8c31e73bc46e1fb5c62e4b1e085baa0eee7f25364f3edaf1dc0b753
7
+ data.tar.gz: b9b8a6ded885468ee5a6af6f5b83daf74c919da4bb7f455d46f6064267c1c543b9a0ebb82df4e75e463d78866c1a991f856ff765c970412aa4478779c4a80179
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # StripeWebhooks
2
2
 
3
- **NOTICE**: This project is in early development. As such, I don't recommend using it for anything serious just yet. You have been warned!
4
-
5
3
  StripeWebhooks is a Rails engine for dealing with data posted from [Stripe via Webhooks](https://stripe.com/docs/webhooks).
6
4
 
7
5
  ## Goals
@@ -38,6 +36,37 @@ First, install and configure the [stripe](https://rubygems.org/gems/stripe) gem
38
36
 
39
37
  5. Restart your application
40
38
 
41
- ## Usage
39
+ ## Configuration
40
+
41
+ Once the gem has been installed and configured, log in to your Stripe account and [configure the webhook](https://stripe.com/docs/webhooks#configuring-your-webhook-settings) with your application endpoint.
42
+
43
+ The `stripe_webhooks` gem will capture and process events using [ActiveJob](http://guides.rubyonrails.org/active_job_basics.html). The default behavior for ActiveJob is to run tasks immediately; It is strongly recommended that you configure a background queue instead. See the ActiveJob docs for a list of available queueing back ends.
44
+
45
+ ## Callbacks
46
+
47
+ Create a callback object using the generator, which accepts a name argument followed by a list of stripe event types.
48
+
49
+ rails g stripe_webhooks:callback Customer customer.created customer.updated customer.deleted
50
+
51
+ *See the [official documentation](https://stripe.com/docs/api/ruby#event_types) for a list of possible events.*
52
+
53
+ This will do a few things for you:
54
+
55
+ 1. Appends an entry to `config/initializers/stripe_webhook_callbacks.rb`, and creates this file if it does not exist.
56
+ 2. Creates a new callback object at `app/callbacks/NAME_callback.rb`
57
+
58
+ A callback is a simple ruby object with a `#run` method.
59
+
60
+ class CustomerCallback < ApplicationCallback
61
+ handles_events 'customer.created', 'customer.updated', 'customer.deleted'
62
+
63
+ def run(event)
64
+ # do useful stuff here!
65
+ end
66
+
67
+ end
68
+
69
+ Callbacks must be registered in order to be recognized. If you ran the generator, this will have been done for you in an initializer.
70
+
71
+ StripeWebhooks.register_callback('customer')
42
72
 
43
- TODO: This project is in the early development phase. This section will be updated as soon as the dust starts to settle.
@@ -3,7 +3,6 @@ module StripeWebhooks
3
3
  queue_as :default
4
4
 
5
5
  def perform(event)
6
- puts "running!"
7
6
  event.validate!
8
7
  if event.is_authentic?
9
8
  event.run_callbacks!
@@ -37,6 +37,10 @@ module StripeWebhooks
37
37
  end
38
38
  extend ClassMethods
39
39
 
40
+ def logger
41
+ return Rails.logger
42
+ end
43
+
40
44
  # Return the label for the callback. Label is based on the class name.
41
45
  #
42
46
  def label
@@ -1,3 +1,3 @@
1
1
  module StripeWebhooks
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1"
3
3
  end
@@ -3,11 +3,45 @@ require 'rails_helper'
3
3
  module StripeWebhooks
4
4
  RSpec.describe EventsController, type: :controller do
5
5
 
6
- describe "GET #create" do
7
- it "returns http success" do
8
- get :create
6
+ routes { StripeWebhooks::Engine.routes }
7
+
8
+ let(:customer_created){
9
+ StripeMock.mock_webhook_payload('customer.created').to_json
10
+ }
11
+
12
+ describe "POST #create" do
13
+
14
+ it "should create the event" do
15
+ expect{
16
+ post :create, customer_created
17
+ }.to change(StripeWebhooks::Event, :count).by(1)
18
+ expect(response).to have_http_status(:success)
19
+ end
20
+
21
+ it "should not create a duplicate event" do
22
+ post :create, customer_created
23
+ expect{
24
+ post :create, customer_created
25
+ }.to_not change(StripeWebhooks::Event, :count)
9
26
  expect(response).to have_http_status(:success)
10
27
  end
28
+
29
+ it "should queue an active job" do
30
+ expect{
31
+ post :create, customer_created
32
+ }.to change(ActiveJob::Base.queue_adapter.enqueued_jobs, :length).by(1)
33
+ expect(ActiveJob::Base.queue_adapter.enqueued_jobs.last[:job]).to eq(StripeWebhooks::ProcessorJob)
34
+ end
35
+
36
+ it "should return an 400 error when the JSON is poorly formed" do
37
+ post :create, File.read(StripeWebhooks::Engine.root.join('spec', 'data', 'parse_error.json'))
38
+ expect(response).to have_http_status(400)
39
+ end
40
+
41
+ it "should return a 422 error when the provided data is not valid" do
42
+ post :create, File.read(StripeWebhooks::Engine.root.join('spec', 'data', 'invalid_data.json'))
43
+ expect(response).to have_http_status(422)
44
+ end
11
45
  end
12
46
 
13
47
  end
@@ -0,0 +1,6 @@
1
+ // Note: ID is intentionally left null
2
+ {
3
+ "created": 1326853478,
4
+ "id": null,
5
+ "type": "charge.succeeded"
6
+ }
@@ -0,0 +1,6 @@
1
+ // Note: Commas have been intentionally omitted
2
+ {
3
+ "created": 1326853478
4
+ "livemode": false
5
+ "id": "evt_00000000000000"
6
+ }
@@ -0,0 +1,3 @@
1
+ class ApplicationCallback < StripeWebhooks::Callback
2
+
3
+ end
@@ -39,4 +39,6 @@ Rails.application.configure do
39
39
 
40
40
  # Raises error for missing translations
41
41
  # config.action_view.raise_on_missing_translations = true
42
+
43
+ config.active_job.queue_adapter = :test
42
44
  end
@@ -1,4 +1,3 @@
1
1
  Rails.application.routes.draw do
2
-
3
2
  mount StripeWebhooks::Engine => "/stripe_webhooks"
4
3
  end
@@ -0,0 +1,37 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20150716195741) do
15
+
16
+ create_table "stripe_webhooks_events", force: :cascade do |t|
17
+ t.string "stripe_event_id", limit: 255
18
+ t.string "stripe_event_type", limit: 255
19
+ t.datetime "stripe_created_at"
20
+ t.boolean "is_processed", default: false
21
+ t.boolean "is_authentic", default: false
22
+ t.datetime "created_at", null: false
23
+ t.datetime "updated_at", null: false
24
+ end
25
+
26
+ add_index "stripe_webhooks_events", ["stripe_event_id"], name: "index_stripe_webhooks_events_on_stripe_event_id", unique: true, using: :btree
27
+
28
+ create_table "stripe_webhooks_performed_callbacks", force: :cascade do |t|
29
+ t.string "stripe_event_id", limit: 255, null: false
30
+ t.string "label", limit: 255, null: false
31
+ t.datetime "created_at", null: false
32
+ t.datetime "updated_at", null: false
33
+ end
34
+
35
+ add_index "stripe_webhooks_performed_callbacks", ["stripe_event_id", "label"], name: "index_stripe_webhooks_performed_callbacks_event_id_label", using: :btree
36
+
37
+ end
@@ -1,10 +1,9 @@
1
1
  FactoryGirl.define do
2
2
  factory :stripe_webhooks_event, :class => 'StripeWebhooks::Event' do
3
- stripe_event_id "MyString"
4
- stripe_event_type "MyString"
5
- stripe_created_at "2015-07-15 11:29:05"
6
- is_processed false
7
- is_authentic false
3
+ stripe_event_id "evt_00000000000000"
4
+ stripe_event_type "charge.succeeded"
5
+ stripe_created_at DateTime.now()
6
+ is_processed true
7
+ is_authentic true
8
8
  end
9
-
10
9
  end
@@ -12,6 +12,6 @@ require 'rails_helper'
12
12
  # end
13
13
  module StripeWebhooks
14
14
  RSpec.describe EventsHelper, type: :helper do
15
- pending "add some examples to (or delete) #{__FILE__}"
15
+
16
16
  end
17
17
  end
@@ -2,6 +2,22 @@ require 'rails_helper'
2
2
 
3
3
  module StripeWebhooks
4
4
  RSpec.describe ProcessorJob, type: :job do
5
- pending "add some examples to (or delete) #{__FILE__}"
5
+
6
+ describe '#perform' do
7
+ it 'should validate the event and run callbacks' do
8
+ mock_event = StripeMock.mock_webhook_event('customer.created')
9
+ event = StripeWebhooks::Event.create(:stripe_event_id => mock_event.id)
10
+ expect(event).to receive(:run_callbacks!)
11
+ StripeWebhooks::ProcessorJob.new(event).perform_now
12
+ end
13
+
14
+ it 'should not run callbacks on an event that is not authentic' do
15
+ event = StripeWebhooks::Event.create(:stripe_event_id => 'fail!')
16
+ expect(event).to_not receive(:run_callbacks!)
17
+ StripeWebhooks::ProcessorJob.perform_now(event)
18
+ end
19
+
20
+ end
21
+
6
22
  end
7
23
  end
@@ -0,0 +1,20 @@
1
+ require 'rails_helper'
2
+
3
+ module StripeWebhooks
4
+ RSpec.describe Callbacks do
5
+
6
+ class ::HelloWorldCallback < StripeWebhooks::Callback
7
+ handles_events 'test'
8
+ end
9
+
10
+ describe '.register_callback' do
11
+ it 'should append the label to the list of callbacks' do
12
+ expect{
13
+ StripeWebhooks.register_callback('hello_world')
14
+ }.to change(StripeWebhooks.callbacks, :length).by(1)
15
+ expect(StripeWebhooks.callbacks.last).to eq('hello_world')
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,81 @@
1
+ require 'rails_helper'
2
+
3
+ module StripeWebhooks
4
+ RSpec.describe Callback, type: :model do
5
+
6
+ class ::CustomerCallback < StripeWebhooks::Callback
7
+ handles_events 'customer.created', 'customer.updated'
8
+ mattr_accessor :callback_has_ran
9
+ mattr_accessor :run_count
10
+ def run(event)
11
+ self.run_count += 1
12
+ self.callback_has_ran = true
13
+ end
14
+ end
15
+ StripeWebhooks.register_callback('customer')
16
+
17
+ # Reset the callback_has_ran flag for each test so we can tell if the callback was triggered
18
+ before(:each) do
19
+ CustomerCallback.run_count = 0
20
+ CustomerCallback.callback_has_ran = false
21
+ end
22
+
23
+ describe '.run_callbacks_for' do
24
+ it 'should run the callbacks' do
25
+ event = StripeMock.mock_webhook_event('customer.created')
26
+ StripeWebhooks::Callback.run_callbacks_for('customer.created', event)
27
+ expect(CustomerCallback.callback_has_ran).to eq(true)
28
+ end
29
+
30
+ it 'should not run a callback that does not handle the requested event type' do
31
+ event = StripeMock.mock_webhook_event('charge.succeeded')
32
+ StripeWebhooks::Callback.run_callbacks_for('charge.succeeded', event)
33
+ expect(CustomerCallback.callback_has_ran).to eq(false)
34
+ end
35
+ end
36
+
37
+ describe '.handles_events' do
38
+ it 'should store a reference to the event types' do
39
+ expect(CustomerCallback.event_types).to eq(['customer.created', 'customer.updated'])
40
+ end
41
+ end
42
+
43
+ describe '#label' do
44
+ it 'should return a label string' do
45
+ expect(CustomerCallback.new.label).to eq('customer')
46
+ end
47
+ end
48
+
49
+ describe '#run_once' do
50
+ it 'should run the callback' do
51
+ callback = CustomerCallback.new()
52
+ event = StripeMock.mock_webhook_event('customer.created')
53
+ callback.run_once(event)
54
+ expect(CustomerCallback.callback_has_ran).to eq(true)
55
+ end
56
+
57
+ it 'should not run the callback if it has been ran before' do
58
+ callback = CustomerCallback.new()
59
+ event = StripeMock.mock_webhook_event('customer.created')
60
+ callback.run_once(event)
61
+ expect{
62
+ callback.run_once(event)
63
+ }.to_not change(CustomerCallback, :run_count)
64
+ expect(CustomerCallback.run_count).to eq(1)
65
+ end
66
+ end
67
+
68
+ describe '#handles?' do
69
+ it 'should return true' do
70
+ callback = CustomerCallback.new()
71
+ expect(callback.handles?('customer.created')).to eq(true)
72
+ end
73
+
74
+ it 'should return false' do
75
+ callback = CustomerCallback.new()
76
+ expect(callback.handles?('charge.succeeded')).to eq(false)
77
+ end
78
+ end
79
+
80
+ end
81
+ end
@@ -2,6 +2,55 @@ require 'rails_helper'
2
2
 
3
3
  module StripeWebhooks
4
4
  RSpec.describe Event, type: :model do
5
- pending "add some examples to (or delete) #{__FILE__}"
5
+
6
+ describe '#stripe_event' do
7
+ it 'should return the event from the Stripe API' do
8
+ mock_event = StripeMock.mock_webhook_event('customer.created')
9
+ event = StripeWebhooks::Event.create(:stripe_event_id => mock_event.id)
10
+ expect(event.stripe_event).to be_a(Stripe::Event)
11
+ end
12
+
13
+ it 'should trigger a Stripe::InvalidRequestError error' do
14
+ event = StripeWebhooks::Event.create(:stripe_event_id => 'fail!')
15
+ expect{
16
+ event.stripe_event
17
+ }.to raise_error(Stripe::InvalidRequestError)
18
+ end
19
+
20
+ it 'should log a warning if the event is too old' do
21
+ mock_event = StripeMock.mock_webhook_event('customer.created')
22
+ event = StripeWebhooks::Event.create(:stripe_event_id => mock_event.id, :created_at => 31.days.ago)
23
+ expect(Rails.logger).to receive(:warn)
24
+ event.stripe_event
25
+ end
26
+ end
27
+
28
+ describe '#validate!' do
29
+ it 'should mark the event as authentic and update the columns' do
30
+ mock_event = StripeMock.mock_webhook_event('customer.created')
31
+ event = StripeWebhooks::Event.create(:stripe_event_id => mock_event.id)
32
+ event.validate!
33
+ expect(event.is_authentic).to eq(true)
34
+ expect(event.is_processed).to eq(true)
35
+ end
36
+
37
+ it 'should mark the event as not authentic' do
38
+ event = StripeWebhooks::Event.create(:stripe_event_id => 'fail!')
39
+ event.validate!
40
+ expect(event.is_authentic).to eq(false)
41
+ expect(event.is_processed).to eq(true)
42
+ end
43
+ end
44
+
45
+ describe '#run_callbacks!' do
46
+ it 'should run callbacks associated with the given event type' do
47
+ mock_event = StripeMock.mock_webhook_event('customer.created')
48
+ event = StripeWebhooks::Event.create(:stripe_event_id => mock_event.id)
49
+ event.validate!
50
+ expect(StripeWebhooks::Callback).to receive(:run_callbacks_for).with(event.stripe_event_type, event.stripe_event)
51
+ event.run_callbacks!
52
+ end
53
+ end
54
+
6
55
  end
7
56
  end
@@ -2,6 +2,6 @@ require 'rails_helper'
2
2
 
3
3
  module StripeWebhooks
4
4
  RSpec.describe PerformedCallback, type: :model do
5
- pending "add some examples to (or delete) #{__FILE__}"
5
+
6
6
  end
7
7
  end
data/spec/rails_helper.rb CHANGED
@@ -1,12 +1,16 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
2
  ENV['RAILS_ENV'] ||= 'test'
3
3
  require 'spec_helper'
4
- require File.expand_path('../../config/environment', __FILE__)
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
5
  require 'rspec/rails'
6
6
 
7
7
  # Add additional requires below this line. Rails is not loaded until this point!
8
8
  require 'database_cleaner'
9
9
  require "factory_girl_rails"
10
+ require 'stripe_mock'
11
+ require 'simplecov'
12
+
13
+ SimpleCov.start 'rails'
10
14
 
11
15
  # Requires supporting ruby files with custom matchers and macros, etc, in
12
16
  # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
@@ -25,7 +29,7 @@ require "factory_girl_rails"
25
29
 
26
30
  # Checks for pending migrations before tests are run.
27
31
  # If you are not using ActiveRecord, you can remove this line.
28
- ActiveRecord::Migration.maintain_test_schema!
32
+ # ActiveRecord::Migration.maintain_test_schema!
29
33
 
30
34
  RSpec.configure do |config|
31
35
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
@@ -51,6 +55,22 @@ RSpec.configure do |config|
51
55
  # https://relishapp.com/rspec/rspec-rails/docs
52
56
  config.infer_spec_type_from_file_location!
53
57
 
58
+ # Clear the active job queue after every test
59
+ #
60
+ config.after(:each) do
61
+ ActiveJob::Base.queue_adapter.enqueued_jobs = []
62
+ ActiveJob::Base.queue_adapter.performed_jobs = []
63
+ end
64
+
65
+ # Use StripeMock to simulate Stripe API calls
66
+ #
67
+ config.before(:each) do
68
+ StripeMock.start
69
+ end
70
+ config.after(:each) do
71
+ StripeMock.stop
72
+ end
73
+
54
74
  # Clean the test database
55
75
  config.before(:suite) do
56
76
  DatabaseCleaner.strategy = :transaction
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe_webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: '0.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Westlake Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.3
19
+ version: 4.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.3
26
+ version: 4.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: stripe
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.22'
33
+ version: 1.18.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.22'
40
+ version: 1.18.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mysql2
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.9.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: stripe-ruby-mock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 2.1.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 2.1.0
111
125
  description: Provides an endpoint for captring data posted via Webhooks in Stripe,
112
126
  and a system for running callbacks in response to desired event types.
113
127
  email:
@@ -119,8 +133,6 @@ files:
119
133
  - MIT-LICENSE
120
134
  - README.md
121
135
  - Rakefile
122
- - app/assets/javascripts/stripe_webhooks/application.js
123
- - app/assets/stylesheets/stripe_webhooks/application.css
124
136
  - app/controllers/stripe_webhooks/application_controller.rb
125
137
  - app/controllers/stripe_webhooks/events_controller.rb
126
138
  - app/helpers/stripe_webhooks/application_helper.rb
@@ -129,7 +141,6 @@ files:
129
141
  - app/models/stripe_webhooks/callback.rb
130
142
  - app/models/stripe_webhooks/event.rb
131
143
  - app/models/stripe_webhooks/performed_callback.rb
132
- - app/views/layouts/stripe_webhooks/application.html.erb
133
144
  - config/routes.rb
134
145
  - db/migrate/20150715152905_create_stripe_webhooks_events.rb
135
146
  - db/migrate/20150716195741_create_stripe_webhooks_performed_callbacks.rb
@@ -143,10 +154,13 @@ files:
143
154
  - lib/stripe_webhooks/version.rb
144
155
  - lib/tasks/stripe_webhooks_tasks.rake
145
156
  - spec/controllers/stripe_webhooks/events_controller_spec.rb
157
+ - spec/data/invalid_data.json
158
+ - spec/data/parse_error.json
146
159
  - spec/dummy/README.rdoc
147
160
  - spec/dummy/Rakefile
148
161
  - spec/dummy/app/assets/javascripts/application.js
149
162
  - spec/dummy/app/assets/stylesheets/application.css
163
+ - spec/dummy/app/callbacks/application_callback.rb
150
164
  - spec/dummy/app/controllers/application_controller.rb
151
165
  - spec/dummy/app/helpers/application_helper.rb
152
166
  - spec/dummy/app/views/layouts/application.html.erb
@@ -169,10 +183,12 @@ files:
169
183
  - spec/dummy/config/initializers/inflections.rb
170
184
  - spec/dummy/config/initializers/mime_types.rb
171
185
  - spec/dummy/config/initializers/session_store.rb
186
+ - spec/dummy/config/initializers/stripe_webhook_callbacks.rb
172
187
  - spec/dummy/config/initializers/wrap_parameters.rb
173
188
  - spec/dummy/config/locales/en.yml
174
189
  - spec/dummy/config/routes.rb
175
190
  - spec/dummy/config/secrets.yml
191
+ - spec/dummy/db/schema.rb
176
192
  - spec/dummy/public/404.html
177
193
  - spec/dummy/public/422.html
178
194
  - spec/dummy/public/500.html
@@ -181,11 +197,12 @@ files:
181
197
  - spec/factories/stripe_webhooks_performed_callbacks.rb
182
198
  - spec/helpers/stripe_webhooks/events_helper_spec.rb
183
199
  - spec/jobs/stripe_webhooks/processor_job_spec.rb
200
+ - spec/lib/stripe_webhooks/callbacks_spec.rb
201
+ - spec/models/stripe_webhooks/callback_spec.rb
184
202
  - spec/models/stripe_webhooks/event_spec.rb
185
203
  - spec/models/stripe_webhooks/performed_callback_spec.rb
186
204
  - spec/rails_helper.rb
187
205
  - spec/spec_helper.rb
188
- - spec/views/stripe_webhooks/events/create.html.erb_spec.rb
189
206
  homepage: https://github.com/westlakedesign/stripe_webhooks
190
207
  licenses:
191
208
  - MIT
@@ -212,8 +229,11 @@ specification_version: 4
212
229
  summary: Stripe Webhook event capture and processing engine.
213
230
  test_files:
214
231
  - spec/controllers/stripe_webhooks/events_controller_spec.rb
232
+ - spec/data/invalid_data.json
233
+ - spec/data/parse_error.json
215
234
  - spec/dummy/app/assets/javascripts/application.js
216
235
  - spec/dummy/app/assets/stylesheets/application.css
236
+ - spec/dummy/app/callbacks/application_callback.rb
217
237
  - spec/dummy/app/controllers/application_controller.rb
218
238
  - spec/dummy/app/helpers/application_helper.rb
219
239
  - spec/dummy/app/views/layouts/application.html.erb
@@ -235,11 +255,13 @@ test_files:
235
255
  - spec/dummy/config/initializers/inflections.rb
236
256
  - spec/dummy/config/initializers/mime_types.rb
237
257
  - spec/dummy/config/initializers/session_store.rb
258
+ - spec/dummy/config/initializers/stripe_webhook_callbacks.rb
238
259
  - spec/dummy/config/initializers/wrap_parameters.rb
239
260
  - spec/dummy/config/locales/en.yml
240
261
  - spec/dummy/config/routes.rb
241
262
  - spec/dummy/config/secrets.yml
242
263
  - spec/dummy/config.ru
264
+ - spec/dummy/db/schema.rb
243
265
  - spec/dummy/public/404.html
244
266
  - spec/dummy/public/422.html
245
267
  - spec/dummy/public/500.html
@@ -250,8 +272,9 @@ test_files:
250
272
  - spec/factories/stripe_webhooks_performed_callbacks.rb
251
273
  - spec/helpers/stripe_webhooks/events_helper_spec.rb
252
274
  - spec/jobs/stripe_webhooks/processor_job_spec.rb
275
+ - spec/lib/stripe_webhooks/callbacks_spec.rb
276
+ - spec/models/stripe_webhooks/callback_spec.rb
253
277
  - spec/models/stripe_webhooks/event_spec.rb
254
278
  - spec/models/stripe_webhooks/performed_callback_spec.rb
255
279
  - spec/rails_helper.rb
256
280
  - spec/spec_helper.rb
257
- - spec/views/stripe_webhooks/events/create.html.erb_spec.rb
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>StripeWebhooks</title>
5
- <%= stylesheet_link_tag "stripe_webhooks/application", media: "all" %>
6
- <%= javascript_include_tag "stripe_webhooks/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,5 +0,0 @@
1
- require 'rails_helper'
2
-
3
- RSpec.describe "events/create.html.erb", type: :view do
4
- pending "add some examples to (or delete) #{__FILE__}"
5
- end