recurly 2.4.7 → 2.4.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of recurly might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/recurly.rb +1 -0
- data/lib/recurly/account.rb +1 -0
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly/webhook.rb +66 -0
- data/lib/recurly/webhook/account_notification.rb +10 -0
- data/lib/recurly/webhook/billing_info_updated_notification.rb +6 -0
- data/lib/recurly/webhook/canceled_account_notification.rb +6 -0
- data/lib/recurly/webhook/canceled_subscription_notification.rb +6 -0
- data/lib/recurly/webhook/closed_invoice_notification.rb +6 -0
- data/lib/recurly/webhook/expired_subscription_notification.rb +6 -0
- data/lib/recurly/webhook/failed_payment_notification.rb +6 -0
- data/lib/recurly/webhook/invoice_notification.rb +12 -0
- data/lib/recurly/webhook/new_account_notification.rb +6 -0
- data/lib/recurly/webhook/new_invoice_notification.rb +6 -0
- data/lib/recurly/webhook/new_subscription_notification.rb +6 -0
- data/lib/recurly/webhook/notification.rb +18 -0
- data/lib/recurly/webhook/past_due_invoice_notification.rb +6 -0
- data/lib/recurly/webhook/processing_invoice_notification.rb +6 -0
- data/lib/recurly/webhook/processing_payment_notification.rb +6 -0
- data/lib/recurly/webhook/reactivated_account_notification.rb +6 -0
- data/lib/recurly/webhook/renewed_subscription_notification.rb +6 -0
- data/lib/recurly/webhook/scheduled_payment_notification.rb +6 -0
- data/lib/recurly/webhook/subscription_notification.rb +12 -0
- data/lib/recurly/webhook/successful_payment_notification.rb +6 -0
- data/lib/recurly/webhook/successful_refund_notification.rb +6 -0
- data/lib/recurly/webhook/transaction_notification.rb +12 -0
- data/lib/recurly/webhook/updated_subscription_notification.rb +6 -0
- data/lib/recurly/webhook/void_payment_notification.rb +6 -0
- metadata +27 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660fc143363dbebd51bf09c75aaddd74aeb43dda
|
4
|
+
data.tar.gz: f9fb32d3c6540d8fde7c6cc2b3eb6616a8ee2da6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f93dcf67ee8a172a8a646f153601fb867652eab00d4bb32eb5ebe1fd04b1ead5855907dd767aaf2c12e0434fa70a308ca57b996acb96e41933402944f8a29f4
|
7
|
+
data.tar.gz: ed29811ad7fbc2b0adcaedeaf06a105a52a11f1809704a4412e125e9f55114cfbd0884d2ca2441b772d0f3025eb814dd3e69ce846ce9b6cdc056ce02ebc4b18e
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Recurly is packaged as a Ruby gem. We recommend you install it with
|
|
12
12
|
[Bundler](http://gembundler.com/) by adding the following line to your Gemfile:
|
13
13
|
|
14
14
|
``` ruby
|
15
|
-
gem 'recurly', '~> 2.4.
|
15
|
+
gem 'recurly', '~> 2.4.8'
|
16
16
|
```
|
17
17
|
|
18
18
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly.rb
CHANGED
data/lib/recurly/account.rb
CHANGED
data/lib/recurly/version.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
module Recurly
|
2
|
+
# The Webhook class handles delegating the webhook request body to the appropriate
|
3
|
+
# notification class. Notification classes enapsualte the supplied data, providing
|
4
|
+
# access to account details, as well as subscription, invoice, and transaction
|
5
|
+
# details where available.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Recurly::Webhook.parse(xml_body) # => #<Recurly::Webhook::NewAccountNotification ...>
|
9
|
+
#
|
10
|
+
# notification = Recurly::Webhook.parse(xml_body)
|
11
|
+
# case notification
|
12
|
+
# when Recurly::Webhook::NewAccountNoficiation
|
13
|
+
# # A new account was created
|
14
|
+
# ...
|
15
|
+
# when Recurly::Webhook::NewSubscriptionNotification
|
16
|
+
# # A new subscription was added
|
17
|
+
# ...
|
18
|
+
# when Recurly::Webhook::SubscriptionNotification
|
19
|
+
# # A subscription-related notification was sent
|
20
|
+
# ...
|
21
|
+
# end
|
22
|
+
module Webhook
|
23
|
+
autoload :Notification, 'recurly/webhook/notification'
|
24
|
+
autoload :AccountNotification, 'recurly/webhook/account_notification'
|
25
|
+
autoload :SubscriptionNotification, 'recurly/webhook/subscription_notification'
|
26
|
+
autoload :InvoiceNotification, 'recurly/webhook/invoice_notification'
|
27
|
+
autoload :TransactionNotification, 'recurly/webhook/transaction_notification'
|
28
|
+
autoload :BillingInfoUpdatedNotification, 'recurly/webhook/billing_info_updated_notification'
|
29
|
+
autoload :CanceledSubscriptionNotification, 'recurly/webhook/canceled_subscription_notification'
|
30
|
+
autoload :CanceledAccountNotification, 'recurly/webhook/canceled_account_notification'
|
31
|
+
autoload :ClosedInvoiceNotification, 'recurly/webhook/closed_invoice_notification'
|
32
|
+
autoload :ExpiredSubscriptionNotification, 'recurly/webhook/expired_subscription_notification'
|
33
|
+
autoload :FailedPaymentNotification, 'recurly/webhook/failed_payment_notification'
|
34
|
+
autoload :NewAccountNotification, 'recurly/webhook/new_account_notification'
|
35
|
+
autoload :NewInvoiceNotification, 'recurly/webhook/new_invoice_notification'
|
36
|
+
autoload :NewSubscriptionNotification, 'recurly/webhook/new_subscription_notification'
|
37
|
+
autoload :PastDueInvoiceNotification, 'recurly/webhook/past_due_invoice_notification'
|
38
|
+
autoload :ReactivatedAccountNotification, 'recurly/webhook/reactivated_account_notification'
|
39
|
+
autoload :RenewedSubscriptionNotification, 'recurly/webhook/renewed_subscription_notification'
|
40
|
+
autoload :SuccessfulPaymentNotification, 'recurly/webhook/successful_payment_notification'
|
41
|
+
autoload :SuccessfulRefundNotification, 'recurly/webhook/successful_refund_notification'
|
42
|
+
autoload :UpdatedSubscriptionNotification, 'recurly/webhook/updated_subscription_notification'
|
43
|
+
autoload :VoidPaymentNotification, 'recurly/webhook/void_payment_notification'
|
44
|
+
autoload :ProcessingPaymentNotification, 'recurly/webhook/processing_payment_notification'
|
45
|
+
autoload :ProcessingInvoiceNotification, 'recurly/webhook/processing_invoice_notification'
|
46
|
+
autoload :ScheduledPaymentNotification, 'recurly/webhook/scheduled_payment_notification'
|
47
|
+
|
48
|
+
# This exception is raised if the Webhook Notification initialization fails
|
49
|
+
class NotificationError < Error
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Resource] A notification.
|
53
|
+
# @raise [NotificationError] For unknown or invalid notifications.
|
54
|
+
def self.parse xml_body
|
55
|
+
xml = XML.new xml_body
|
56
|
+
class_name = Helper.classify xml.name
|
57
|
+
|
58
|
+
if Webhook.const_defined?(class_name, false)
|
59
|
+
klass = Webhook.const_get class_name
|
60
|
+
klass.from_xml xml_body
|
61
|
+
else
|
62
|
+
raise NotificationError, "'#{class_name}' is not a recognized notification"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Webhook
|
3
|
+
# The InvoiceNotification class provides a generic interface
|
4
|
+
# for account-related webhook notifications.
|
5
|
+
class InvoiceNotification < Notification
|
6
|
+
# @return [Account]
|
7
|
+
has_one :account
|
8
|
+
# @return [Invoice]
|
9
|
+
has_one :invoice
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Webhook
|
3
|
+
# The TransactionNotification class provides a generic interface
|
4
|
+
# for account-related webhook notifications.
|
5
|
+
class Notification < Resource
|
6
|
+
# Provides a convenience method to reload assocated members because Webhook
|
7
|
+
# notifications are not to be considered current.
|
8
|
+
def self.has_one member_name, options = {}
|
9
|
+
define_method("#{member_name}!") do
|
10
|
+
member = self[member_name]
|
11
|
+
member.reload if member
|
12
|
+
end
|
13
|
+
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Webhook
|
3
|
+
# The SubscriptionNotification class provides a generic interface
|
4
|
+
# for account-related webhook notifications.
|
5
|
+
class SubscriptionNotification < Notification
|
6
|
+
# @return [Account]
|
7
|
+
has_one :account
|
8
|
+
# @return [Subscription]
|
9
|
+
has_one :subscription
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Webhook
|
3
|
+
# The TransactionNotification class provides a generic interface
|
4
|
+
# for account-related webhook notifications.
|
5
|
+
class TransactionNotification < Notification
|
6
|
+
# @return [Account]
|
7
|
+
has_one :account
|
8
|
+
# @return [Transaction]
|
9
|
+
has_one :transaction
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -93,6 +93,31 @@ files:
|
|
93
93
|
- lib/recurly/transaction.rb
|
94
94
|
- lib/recurly/transaction/errors.rb
|
95
95
|
- lib/recurly/version.rb
|
96
|
+
- lib/recurly/webhook.rb
|
97
|
+
- lib/recurly/webhook/account_notification.rb
|
98
|
+
- lib/recurly/webhook/billing_info_updated_notification.rb
|
99
|
+
- lib/recurly/webhook/canceled_account_notification.rb
|
100
|
+
- lib/recurly/webhook/canceled_subscription_notification.rb
|
101
|
+
- lib/recurly/webhook/closed_invoice_notification.rb
|
102
|
+
- lib/recurly/webhook/expired_subscription_notification.rb
|
103
|
+
- lib/recurly/webhook/failed_payment_notification.rb
|
104
|
+
- lib/recurly/webhook/invoice_notification.rb
|
105
|
+
- lib/recurly/webhook/new_account_notification.rb
|
106
|
+
- lib/recurly/webhook/new_invoice_notification.rb
|
107
|
+
- lib/recurly/webhook/new_subscription_notification.rb
|
108
|
+
- lib/recurly/webhook/notification.rb
|
109
|
+
- lib/recurly/webhook/past_due_invoice_notification.rb
|
110
|
+
- lib/recurly/webhook/processing_invoice_notification.rb
|
111
|
+
- lib/recurly/webhook/processing_payment_notification.rb
|
112
|
+
- lib/recurly/webhook/reactivated_account_notification.rb
|
113
|
+
- lib/recurly/webhook/renewed_subscription_notification.rb
|
114
|
+
- lib/recurly/webhook/scheduled_payment_notification.rb
|
115
|
+
- lib/recurly/webhook/subscription_notification.rb
|
116
|
+
- lib/recurly/webhook/successful_payment_notification.rb
|
117
|
+
- lib/recurly/webhook/successful_refund_notification.rb
|
118
|
+
- lib/recurly/webhook/transaction_notification.rb
|
119
|
+
- lib/recurly/webhook/updated_subscription_notification.rb
|
120
|
+
- lib/recurly/webhook/void_payment_notification.rb
|
96
121
|
- lib/recurly/xml.rb
|
97
122
|
- lib/recurly/xml/nokogiri.rb
|
98
123
|
- lib/recurly/xml/rexml.rb
|