recurly 2.7.3 → 2.7.4
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/rails/recurly.rb +6 -1
- data/lib/recurly/coupon.rb +1 -1
- data/lib/recurly/gift_card.rb +1 -0
- data/lib/recurly/measured_unit.rb +1 -0
- data/lib/recurly/resource.rb +19 -10
- data/lib/recurly/subscription.rb +1 -0
- data/lib/recurly/subscription/add_ons.rb +2 -1
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly/webhook.rb +3 -1
- data/lib/recurly/webhook/dunning_notification.rb +14 -0
- data/lib/recurly/webhook/new_dunning_event_notification.rb +6 -0
- metadata +113 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8cdc190978fed596fdf9c6a17d30eb2b63ba8e5
|
4
|
+
data.tar.gz: 575cb6981a32e629ab3f3ef35289a23a2d3bcd15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2472d0013209e92ead7acb9d45b0a9778def95669be78b51a97f6da8f45f045abb16d18cfd00651a138d8e5cb4a2b3e8309a019225260162c767706c60a86830
|
7
|
+
data.tar.gz: 36b4556facfc67c1c7906db07d8fc8c5a66a0f92b52a97043016f5fcdeb537a87f4c511e717ca155044924efe00b52e9a11a147b83f9c57862bb401354db3601
|
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.7.
|
15
|
+
gem 'recurly', '~> 2.7.4'
|
16
16
|
```
|
17
17
|
|
18
18
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/rails/recurly.rb
CHANGED
@@ -5,7 +5,12 @@ module Recurly
|
|
5
5
|
end
|
6
6
|
|
7
7
|
initializer :recurly_set_accept_language do
|
8
|
-
|
8
|
+
prepend_method = :prepend_before_filter
|
9
|
+
if ActionController::Base.respond_to?(:prepend_before_action)
|
10
|
+
prepend_method = :prepend_before_action
|
11
|
+
end
|
12
|
+
|
13
|
+
ActionController::Base.send(prepend_method) do
|
9
14
|
Recurly::API.accept_language = request.env['HTTP_ACCEPT_LANGUAGE']
|
10
15
|
end
|
11
16
|
end
|
data/lib/recurly/coupon.rb
CHANGED
data/lib/recurly/gift_card.rb
CHANGED
data/lib/recurly/resource.rb
CHANGED
@@ -140,21 +140,30 @@ module Recurly
|
|
140
140
|
# rescue Recurly::Resource::Invalid => e
|
141
141
|
# e.record.errors # => errors: {"account_code"=>["can't be blank"]}>
|
142
142
|
# end
|
143
|
-
class Invalid <
|
143
|
+
class Invalid < Error
|
144
144
|
# @return [Resource, nil] The invalid record.
|
145
145
|
attr_reader :record
|
146
146
|
|
147
|
-
def initialize(
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
record_or_message.errors.map { |k, v| "#{k} #{v * ', '}" }.join '; '
|
147
|
+
def initialize(message)
|
148
|
+
if message.is_a? Resource
|
149
|
+
@record = message
|
150
|
+
set_message(record_to_message)
|
152
151
|
else
|
153
|
-
|
152
|
+
set_message(message)
|
154
153
|
end
|
155
154
|
end
|
155
|
+
|
156
|
+
private
|
157
|
+
|
158
|
+
def record_to_message
|
159
|
+
@record.errors.map do |k, v|
|
160
|
+
message = v.join(', ')
|
161
|
+
k == 'base' ? message : "#{k} #{message}"
|
162
|
+
end.join('; ')
|
163
|
+
end
|
156
164
|
end
|
157
165
|
|
166
|
+
|
158
167
|
class << self
|
159
168
|
# @return [String] The demodulized name of the resource class.
|
160
169
|
# @example
|
@@ -407,12 +416,12 @@ module Recurly
|
|
407
416
|
}
|
408
417
|
next
|
409
418
|
end
|
410
|
-
|
419
|
+
|
411
420
|
# Nokogiri on Jruby-1.7.19 likes to throw NullPointer exceptions
|
412
421
|
# if you try to run certian operations like el.attribute(''). Since
|
413
422
|
# we dont care about text nodes, let's just skip them
|
414
|
-
next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.node_type == Nokogiri::XML::Node::TEXT_NODE
|
415
|
-
|
423
|
+
next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.node_type == Nokogiri::XML::Node::TEXT_NODE
|
424
|
+
|
416
425
|
if el.children.empty? && href = el.attribute('href')
|
417
426
|
klass_name = Helper.classify(klass.association_class_name(el.name) ||
|
418
427
|
el.attribute('type') ||
|
data/lib/recurly/subscription.rb
CHANGED
@@ -27,7 +27,8 @@ module Recurly
|
|
27
27
|
|
28
28
|
exist = @add_ons.find { |a| a.add_on_code == add_on.add_on_code }
|
29
29
|
if exist
|
30
|
-
exist.quantity ||= 1
|
30
|
+
exist.quantity ||= 1
|
31
|
+
exist.quantity += add_on.quantity || 1
|
31
32
|
|
32
33
|
if add_on.unit_amount_in_cents
|
33
34
|
exist.unit_amount_in_cents = add_on.unit_amount_in_cents
|
data/lib/recurly/version.rb
CHANGED
data/lib/recurly/webhook.rb
CHANGED
@@ -25,6 +25,7 @@ module Recurly
|
|
25
25
|
autoload :SubscriptionNotification, 'recurly/webhook/subscription_notification'
|
26
26
|
autoload :InvoiceNotification, 'recurly/webhook/invoice_notification'
|
27
27
|
autoload :TransactionNotification, 'recurly/webhook/transaction_notification'
|
28
|
+
autoload :DunningNotification, 'recurly/webhook/dunning_notification'
|
28
29
|
autoload :BillingInfoUpdatedNotification, 'recurly/webhook/billing_info_updated_notification'
|
29
30
|
autoload :CanceledSubscriptionNotification, 'recurly/webhook/canceled_subscription_notification'
|
30
31
|
autoload :CanceledAccountNotification, 'recurly/webhook/canceled_account_notification'
|
@@ -44,6 +45,7 @@ module Recurly
|
|
44
45
|
autoload :ProcessingPaymentNotification, 'recurly/webhook/processing_payment_notification'
|
45
46
|
autoload :ProcessingInvoiceNotification, 'recurly/webhook/processing_invoice_notification'
|
46
47
|
autoload :ScheduledPaymentNotification, 'recurly/webhook/scheduled_payment_notification'
|
48
|
+
autoload :NewDunningEventNotification, 'recurly/webhook/new_dunning_event_notification'
|
47
49
|
|
48
50
|
# This exception is raised if the Webhook Notification initialization fails
|
49
51
|
class NotificationError < Error
|
@@ -54,7 +56,7 @@ module Recurly
|
|
54
56
|
def self.parse xml_body
|
55
57
|
xml = XML.new xml_body
|
56
58
|
class_name = Helper.classify xml.name
|
57
|
-
|
59
|
+
|
58
60
|
if Webhook.const_defined?(class_name, false)
|
59
61
|
klass = Webhook.const_get class_name
|
60
62
|
klass.from_xml xml_body
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Webhook
|
3
|
+
class DunningNotification < Notification
|
4
|
+
# @return [Account]
|
5
|
+
has_one :account
|
6
|
+
# @return [Subscription]
|
7
|
+
has_one :subscription
|
8
|
+
# @return [Invoice]
|
9
|
+
has_one :invoice
|
10
|
+
# @return [Transaction]
|
11
|
+
has_one :transaction
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,57 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- -
|
31
|
+
- - ~>
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
33
|
+
version: 11.1.0
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- -
|
38
|
+
- - ~>
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
40
|
+
version: 11.1.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: minitest
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 5.8.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 5.8.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: addressable
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
61
|
+
version: 2.4.0
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- -
|
66
|
+
- - ~>
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
68
|
+
version: 2.4.0
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: webmock
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
|
-
- -
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.24.6
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.24.6
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: redcarpet
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
46
102
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
103
|
+
version: '0'
|
48
104
|
type: :development
|
49
105
|
prerelease: false
|
50
106
|
version_requirements: !ruby/object:Gem::Requirement
|
51
107
|
requirements:
|
52
|
-
- -
|
108
|
+
- - '>='
|
53
109
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: racc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
55
139
|
description: 'An API client library for Recurly: http://recurly.com'
|
56
140
|
email: support@recurly.com
|
57
141
|
executables:
|
@@ -60,21 +144,18 @@ extensions: []
|
|
60
144
|
extra_rdoc_files:
|
61
145
|
- README.md
|
62
146
|
files:
|
63
|
-
- README.md
|
64
|
-
- bin/recurly
|
65
147
|
- lib/ecurly.rb
|
66
148
|
- lib/rails/generators/recurly/config_generator.rb
|
67
149
|
- lib/rails/recurly.rb
|
68
|
-
- lib/recurly.rb
|
69
150
|
- lib/recurly/account.rb
|
70
151
|
- lib/recurly/account_balance.rb
|
71
152
|
- lib/recurly/add_on.rb
|
72
153
|
- lib/recurly/address.rb
|
73
154
|
- lib/recurly/adjustment.rb
|
74
155
|
- lib/recurly/all.rb
|
75
|
-
- lib/recurly/api.rb
|
76
156
|
- lib/recurly/api/errors.rb
|
77
157
|
- lib/recurly/api/net_http_adapter.rb
|
158
|
+
- lib/recurly/api.rb
|
78
159
|
- lib/recurly/billing_info.rb
|
79
160
|
- lib/recurly/coupon.rb
|
80
161
|
- lib/recurly/delivery.rb
|
@@ -87,29 +168,30 @@ files:
|
|
87
168
|
- lib/recurly/money.rb
|
88
169
|
- lib/recurly/plan.rb
|
89
170
|
- lib/recurly/redemption.rb
|
90
|
-
- lib/recurly/resource.rb
|
91
171
|
- lib/recurly/resource/association.rb
|
92
172
|
- lib/recurly/resource/errors.rb
|
93
173
|
- lib/recurly/resource/pager.rb
|
174
|
+
- lib/recurly/resource.rb
|
94
175
|
- lib/recurly/shipping_address.rb
|
95
|
-
- lib/recurly/subscription.rb
|
96
176
|
- lib/recurly/subscription/add_ons.rb
|
177
|
+
- lib/recurly/subscription.rb
|
97
178
|
- lib/recurly/subscription_add_on.rb
|
98
179
|
- lib/recurly/tax_detail.rb
|
99
|
-
- lib/recurly/transaction.rb
|
100
180
|
- lib/recurly/transaction/errors.rb
|
181
|
+
- lib/recurly/transaction.rb
|
101
182
|
- lib/recurly/usage.rb
|
102
183
|
- lib/recurly/version.rb
|
103
|
-
- lib/recurly/webhook.rb
|
104
184
|
- lib/recurly/webhook/account_notification.rb
|
105
185
|
- lib/recurly/webhook/billing_info_updated_notification.rb
|
106
186
|
- lib/recurly/webhook/canceled_account_notification.rb
|
107
187
|
- lib/recurly/webhook/canceled_subscription_notification.rb
|
108
188
|
- lib/recurly/webhook/closed_invoice_notification.rb
|
189
|
+
- lib/recurly/webhook/dunning_notification.rb
|
109
190
|
- lib/recurly/webhook/expired_subscription_notification.rb
|
110
191
|
- lib/recurly/webhook/failed_payment_notification.rb
|
111
192
|
- lib/recurly/webhook/invoice_notification.rb
|
112
193
|
- lib/recurly/webhook/new_account_notification.rb
|
194
|
+
- lib/recurly/webhook/new_dunning_event_notification.rb
|
113
195
|
- lib/recurly/webhook/new_invoice_notification.rb
|
114
196
|
- lib/recurly/webhook/new_subscription_notification.rb
|
115
197
|
- lib/recurly/webhook/notification.rb
|
@@ -125,32 +207,36 @@ files:
|
|
125
207
|
- lib/recurly/webhook/transaction_notification.rb
|
126
208
|
- lib/recurly/webhook/updated_subscription_notification.rb
|
127
209
|
- lib/recurly/webhook/void_payment_notification.rb
|
128
|
-
- lib/recurly/
|
210
|
+
- lib/recurly/webhook.rb
|
129
211
|
- lib/recurly/xml/nokogiri.rb
|
130
212
|
- lib/recurly/xml/rexml.rb
|
213
|
+
- lib/recurly/xml.rb
|
214
|
+
- lib/recurly.rb
|
215
|
+
- README.md
|
216
|
+
- bin/recurly
|
131
217
|
homepage: https://github.com/recurly/recurly-client-ruby
|
132
218
|
licenses:
|
133
219
|
- MIT
|
134
220
|
metadata: {}
|
135
221
|
post_install_message:
|
136
222
|
rdoc_options:
|
137
|
-
-
|
223
|
+
- --main
|
138
224
|
- README.md
|
139
225
|
require_paths:
|
140
226
|
- lib
|
141
227
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
228
|
requirements:
|
143
|
-
- -
|
229
|
+
- - '>='
|
144
230
|
- !ruby/object:Gem::Version
|
145
231
|
version: 1.9.3
|
146
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
233
|
requirements:
|
148
|
-
- -
|
234
|
+
- - '>='
|
149
235
|
- !ruby/object:Gem::Version
|
150
236
|
version: '0'
|
151
237
|
requirements: []
|
152
238
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.0.14.1
|
154
240
|
signing_key:
|
155
241
|
specification_version: 4
|
156
242
|
summary: Recurly API Client
|