Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly require ostruct gem in webhook model #1081

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PATH
remote: .
specs:
pay (8.0.0)
ostruct
rails (>= 6.0.0)

GEM
Expand Down
2 changes: 2 additions & 0 deletions app/models/pay/braintree/subscription.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "ostruct"

module Pay
module Braintree
class Subscription < Pay::Subscription
Expand Down
2 changes: 2 additions & 0 deletions app/models/pay/webhook.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "ostruct"

module Pay
class Webhook < Pay::ApplicationRecord
validates :processor, presence: true
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ gem "net-imap", require: false
gem "net-pop", require: false
gem "net-smtp", require: false
gem "rails", "~> 6.1.0"
gem "ostruct"

gemspec path: "../"
3 changes: 3 additions & 0 deletions gemfiles/rails_6_1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PATH
remote: ..
specs:
pay (8.0.0)
ostruct
rails (>= 6.0.0)

GEM
Expand Down Expand Up @@ -146,6 +147,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
paddle (2.5.1)
faraday (~> 2.0)
parallel (1.26.3)
Expand Down Expand Up @@ -293,6 +295,7 @@ DEPENDENCIES
net-imap
net-pop
net-smtp
ostruct
paddle (~> 2.4)
pay!
pg
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_7.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ gem "net-imap", require: false
gem "net-pop", require: false
gem "net-smtp", require: false
gem "rails", "~> 7.0.0"
gem "ostruct"

gemspec path: "../"
3 changes: 3 additions & 0 deletions gemfiles/rails_7.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PATH
remote: ..
specs:
pay (8.0.0)
ostruct
rails (>= 6.0.0)

GEM
Expand Down Expand Up @@ -152,6 +153,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
paddle (2.5.1)
faraday (~> 2.0)
parallel (1.26.3)
Expand Down Expand Up @@ -299,6 +301,7 @@ DEPENDENCIES
net-imap
net-pop
net-smtp
ostruct
paddle (~> 2.4)
pay!
pg
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_7_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ gem "net-imap", require: false
gem "net-pop", require: false
gem "net-smtp", require: false
gem "rails", "~> 7.1.0"
gem "ostruct"

gemspec path: "../"
3 changes: 3 additions & 0 deletions gemfiles/rails_7_1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PATH
remote: ..
specs:
pay (8.0.0)
ostruct
rails (>= 6.0.0)

GEM
Expand Down Expand Up @@ -167,6 +168,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
paddle (2.5.1)
faraday (~> 2.0)
parallel (1.26.3)
Expand Down Expand Up @@ -325,6 +327,7 @@ DEPENDENCIES
net-imap
net-pop
net-smtp
ostruct
paddle (~> 2.4)
pay!
pg
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_7_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ gem "net-imap", require: false
gem "net-pop", require: false
gem "net-smtp", require: false
gem "rails", "~> 7.2.0.rc1"
gem "ostruct"

gemspec path: "../"
3 changes: 3 additions & 0 deletions gemfiles/rails_7_2.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PATH
remote: ..
specs:
pay (8.0.0)
ostruct
rails (>= 6.0.0)

GEM
Expand Down Expand Up @@ -162,6 +163,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
paddle (2.5.1)
faraday (~> 2.0)
parallel (1.26.3)
Expand Down Expand Up @@ -325,6 +327,7 @@ DEPENDENCIES
net-imap
net-pop
net-smtp
ostruct
paddle (~> 2.4)
pay!
pg
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_main.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ gem "net-imap", require: false
gem "net-pop", require: false
gem "net-smtp", require: false
gem "rails", branch: "main", git: "https:/rails/rails.git"
gem "ostruct"

gemspec path: "../"
3 changes: 3 additions & 0 deletions gemfiles/rails_main.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ PATH
remote: ..
specs:
pay (8.0.0)
ostruct
rails (>= 6.0.0)

GEM
Expand Down Expand Up @@ -190,6 +191,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
paddle (2.5.1)
faraday (~> 2.0)
parallel (1.26.3)
Expand Down Expand Up @@ -331,6 +333,7 @@ DEPENDENCIES
net-imap
net-pop
net-smtp
ostruct
paddle (~> 2.4)
pay!
pg
Expand Down
1 change: 1 addition & 0 deletions pay.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ Gem::Specification.new do |s|
]

s.add_dependency "rails", ">= 6.0.0"
s.add_dependency "ostruct"
end
7 changes: 7 additions & 0 deletions test/models/pay/webhook_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ class Pay::Webhook::Test < ActiveSupport::TestCase
assert_equal "visa", event.payment_method.card_type
end

test "rehydrates a Paddle Billing event" do
pay_webhook = Pay::Webhook.create processor: :paddle_billing, event_type: :example, event: json_fixture("paddle_billing/subscription.created")
event = pay_webhook.rehydrated_event
assert_equal OpenStruct, event.class
assert_equal "month", event.billing_cycle.interval
end

test "rehydrates a Stripe event" do
pay_webhook = Pay::Webhook.create processor: :stripe, event_type: :example, event: json_fixture("stripe/customer.updated")
event = pay_webhook.rehydrated_event
Expand Down