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.

Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/recurly.rb +1 -0
  4. data/lib/recurly/account.rb +1 -0
  5. data/lib/recurly/version.rb +1 -1
  6. data/lib/recurly/webhook.rb +66 -0
  7. data/lib/recurly/webhook/account_notification.rb +10 -0
  8. data/lib/recurly/webhook/billing_info_updated_notification.rb +6 -0
  9. data/lib/recurly/webhook/canceled_account_notification.rb +6 -0
  10. data/lib/recurly/webhook/canceled_subscription_notification.rb +6 -0
  11. data/lib/recurly/webhook/closed_invoice_notification.rb +6 -0
  12. data/lib/recurly/webhook/expired_subscription_notification.rb +6 -0
  13. data/lib/recurly/webhook/failed_payment_notification.rb +6 -0
  14. data/lib/recurly/webhook/invoice_notification.rb +12 -0
  15. data/lib/recurly/webhook/new_account_notification.rb +6 -0
  16. data/lib/recurly/webhook/new_invoice_notification.rb +6 -0
  17. data/lib/recurly/webhook/new_subscription_notification.rb +6 -0
  18. data/lib/recurly/webhook/notification.rb +18 -0
  19. data/lib/recurly/webhook/past_due_invoice_notification.rb +6 -0
  20. data/lib/recurly/webhook/processing_invoice_notification.rb +6 -0
  21. data/lib/recurly/webhook/processing_payment_notification.rb +6 -0
  22. data/lib/recurly/webhook/reactivated_account_notification.rb +6 -0
  23. data/lib/recurly/webhook/renewed_subscription_notification.rb +6 -0
  24. data/lib/recurly/webhook/scheduled_payment_notification.rb +6 -0
  25. data/lib/recurly/webhook/subscription_notification.rb +12 -0
  26. data/lib/recurly/webhook/successful_payment_notification.rb +6 -0
  27. data/lib/recurly/webhook/successful_refund_notification.rb +6 -0
  28. data/lib/recurly/webhook/transaction_notification.rb +12 -0
  29. data/lib/recurly/webhook/updated_subscription_notification.rb +6 -0
  30. data/lib/recurly/webhook/void_payment_notification.rb +6 -0
  31. metadata +27 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1203bd1945ec1c2eae87b580b09a47a214965a6c
4
- data.tar.gz: ba492e09b36d0479a5e41ea1e29b41ccc94561b2
3
+ metadata.gz: 660fc143363dbebd51bf09c75aaddd74aeb43dda
4
+ data.tar.gz: f9fb32d3c6540d8fde7c6cc2b3eb6616a8ee2da6
5
5
  SHA512:
6
- metadata.gz: bc27d6d635846fb6a9fdcfda6755be969c92f1b97d32a2fec8fc8918a78dff58084d1e41f95a9dda0660de5273eed9ba075d52d826f163807f9d69d7d5f39d68
7
- data.tar.gz: 120302e3ea0d5b8038b4607957c396d1ccc86f79f18214ab3df402f1455ebcf952ca6ef1ce7cdef5d640f9f484866f9f70ba25ae40be1832edeb51780d322486
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.7'
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
@@ -20,6 +20,7 @@ module Recurly
20
20
  autoload :Transaction, 'recurly/transaction'
21
21
  autoload :Version, 'recurly/version'
22
22
  autoload :XML, 'recurly/xml'
23
+ autoload :Webhook, 'recurly/webhook'
23
24
 
24
25
  @subdomain = nil
25
26
 
@@ -31,6 +31,7 @@ module Recurly
31
31
  state
32
32
  username
33
33
  email
34
+ cc_emails
34
35
  first_name
35
36
  last_name
36
37
  company_name
@@ -2,7 +2,7 @@ module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 4
5
- PATCH = 7
5
+ PATCH = 8
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
@@ -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,10 @@
1
+ module Recurly
2
+ module Webhook
3
+ # The AccountNotification class provides a generic interface
4
+ # for account-related webhook notifications.
5
+ class AccountNotification < Notification
6
+ # @return [Account]
7
+ has_one :account
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class BillingInfoUpdatedNotification < AccountNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class CanceledAccountNotification < AccountNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class CanceledSubscriptionNotification < SubscriptionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class ClosedInvoiceNotification < InvoiceNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class ExpiredSubscriptionNotification < SubscriptionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class FailedPaymentNotification < TransactionNotification
4
+ end
5
+ end
6
+ 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,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class NewAccountNotification < AccountNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class NewInvoiceNotification < InvoiceNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class NewSubscriptionNotification < SubscriptionNotification
4
+ end
5
+ end
6
+ 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,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class PastDueInvoiceNotification < InvoiceNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class ProcessingInvoiceNotification < InvoiceNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class ProcessingPaymentNotification < TransactionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class ReactivatedAccountNotification < SubscriptionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class RenewedSubscriptionNotification < SubscriptionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class ScheduledPaymentNotification < TransactionNotification
4
+ end
5
+ end
6
+ 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,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class SuccessfulPaymentNotification < TransactionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class SuccessfulRefundNotification < TransactionNotification
4
+ end
5
+ end
6
+ 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
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class UpdatedSubscriptionNotification < SubscriptionNotification
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Recurly
2
+ module Webhook
3
+ class VoidPaymentNotification < TransactionNotification
4
+ end
5
+ end
6
+ 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.7
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-02 00:00:00.000000000 Z
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