recurly 2.7.9 → 2.8.0.rc1
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 +5 -5
- data/README.md +2 -2
- data/lib/recurly.rb +2 -18
- data/lib/recurly/address.rb +1 -0
- data/lib/recurly/adjustment.rb +1 -1
- data/lib/recurly/api.rb +1 -9
- data/lib/recurly/api/net_http_adapter.rb +0 -1
- data/lib/recurly/billing_info.rb +1 -0
- data/lib/recurly/invoice.rb +3 -0
- data/lib/recurly/juris_detail.rb +14 -0
- data/lib/recurly/resource.rb +26 -26
- data/lib/recurly/shipping_address.rb +1 -0
- data/lib/recurly/tax_type.rb +12 -0
- data/lib/recurly/usage.rb +0 -1
- data/lib/recurly/version.rb +3 -3
- metadata +37 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ca9776ef6af4e7c22cf4faf0ce8279355c9bf092
|
4
|
+
data.tar.gz: b2c8fe61d496adaf53fa864377b20d9c1cb956dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ea982954b998bf53a84aaa309a1abbe35008c490bbbd3274a5d44a3dd6dc2910f3cce4e9063c450fad830ce6fdd74ad04368f7d14fe1ebbbef9d014b11287b
|
7
|
+
data.tar.gz: 1192faf1121e4e49457a862083feeb010923d79bf7992bcec60609bc7e62452327fda3d8cb87774b39718bbd93e274d581ab15254fc04a05facf70ac92f46c7f
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Recurly [![Build Status](https://secure.travis-ci.org/recurly/recurly-client-ruby.png
|
1
|
+
# Recurly [![Build Status](https://secure.travis-ci.org/recurly/recurly-client-ruby.png)](http://travis-ci.org/recurly/recurly-client-ruby) [![Gem Version](https://badge.fury.io/rb/recurly.svg)](http://badge.fury.io/rb/recurly)
|
2
2
|
|
3
3
|
<https://github.com/recurly/recurly-client-ruby>
|
4
4
|
|
@@ -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.5'
|
16
16
|
```
|
17
17
|
|
18
18
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly.rb
CHANGED
@@ -10,6 +10,8 @@ module Recurly
|
|
10
10
|
require 'recurly/add_on'
|
11
11
|
require 'recurly/address'
|
12
12
|
require 'recurly/tax_detail'
|
13
|
+
require 'recurly/tax_type'
|
14
|
+
require 'recurly/juris_detail'
|
13
15
|
require 'recurly/adjustment'
|
14
16
|
require 'recurly/coupon'
|
15
17
|
require 'recurly/helper'
|
@@ -84,8 +86,6 @@ module Recurly
|
|
84
86
|
end
|
85
87
|
|
86
88
|
# Assigns a logger to log requests/responses and more.
|
87
|
-
# The logger can only be set if the environment variable
|
88
|
-
# `RECURLY_INSECURE_DEBUG` equals `true`.
|
89
89
|
#
|
90
90
|
# @return [Logger, nil]
|
91
91
|
# @example
|
@@ -97,22 +97,6 @@ module Recurly
|
|
97
97
|
# Recurly.logger = nil # Or Recurly.logger = Logger.new nil
|
98
98
|
attr_accessor :logger
|
99
99
|
|
100
|
-
def logger=(logger)
|
101
|
-
if ENV['RECURLY_INSECURE_DEBUG'].to_s.downcase == 'true'
|
102
|
-
@logger = logger
|
103
|
-
puts <<-MSG
|
104
|
-
[WARNING] Recurly logger enabled. The logger has the potential to leak
|
105
|
-
PII and should never be used in production environments.
|
106
|
-
MSG
|
107
|
-
else
|
108
|
-
puts <<-MSG
|
109
|
-
[WARNING] Recurly logger has been disabled. If you wish to use it,
|
110
|
-
only do so in a non-production environment and make sure
|
111
|
-
the `RECURLY_INSECURE_DEBUG` environment variable is set to `true`.
|
112
|
-
MSG
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
100
|
# Convenience logging method includes a Logger#progname dynamically.
|
117
101
|
# @return [true, nil]
|
118
102
|
def log level, message
|
data/lib/recurly/address.rb
CHANGED
data/lib/recurly/adjustment.rb
CHANGED
data/lib/recurly/api.rb
CHANGED
@@ -15,9 +15,8 @@ module Recurly
|
|
15
15
|
require 'recurly/api/errors'
|
16
16
|
|
17
17
|
@@base_uri = "https://api.recurly.com/v2/"
|
18
|
-
@@valid_domains = [".recurly.com"]
|
19
18
|
|
20
|
-
RECURLY_API_VERSION = '2.
|
19
|
+
RECURLY_API_VERSION = '2.5'
|
21
20
|
|
22
21
|
FORMATS = Helper.hash_with_indifferent_read_access(
|
23
22
|
'pdf' => 'application/pdf',
|
@@ -76,13 +75,6 @@ module Recurly
|
|
76
75
|
URI.parse @@base_uri.sub('api', Recurly.subdomain)
|
77
76
|
end
|
78
77
|
|
79
|
-
def validate_uri!(uri)
|
80
|
-
domain = @@valid_domains.detect { |d| uri.host.end_with?(d) }
|
81
|
-
unless domain
|
82
|
-
raise ArgumentError, "URI #{uri} is invalid. You may only make requests to a Recurly domain."
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
78
|
# @return [String]
|
87
79
|
def user_agent
|
88
80
|
"Recurly/#{Version}; #{RUBY_DESCRIPTION}"
|
data/lib/recurly/billing_info.rb
CHANGED
@@ -25,6 +25,7 @@ module Recurly
|
|
25
25
|
ip_address_country
|
26
26
|
token_id
|
27
27
|
currency
|
28
|
+
geo_code
|
28
29
|
) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES
|
29
30
|
|
30
31
|
# @return ["credit_card", "paypal", "amazon", "bank_account", "roku", nil] The type of billing info.
|
data/lib/recurly/invoice.rb
CHANGED
data/lib/recurly/resource.rb
CHANGED
@@ -337,8 +337,9 @@ module Recurly
|
|
337
337
|
raise NotFound, "can't find a record with nil identifier"
|
338
338
|
end
|
339
339
|
|
340
|
+
uri = uuid =~ /^http/ ? uuid : member_path(uuid)
|
340
341
|
begin
|
341
|
-
from_response API.get(
|
342
|
+
from_response API.get(uri, {}, options)
|
342
343
|
rescue API::NotFound => e
|
343
344
|
raise NotFound, e.description
|
344
345
|
end
|
@@ -369,17 +370,13 @@ module Recurly
|
|
369
370
|
# @return [Resource]
|
370
371
|
# @param response [Net::HTTPResponse]
|
371
372
|
def from_response(response)
|
372
|
-
|
373
|
-
|
374
|
-
case content_type
|
373
|
+
case response['Content-Type']
|
375
374
|
when %r{application/pdf}
|
376
375
|
response.body
|
377
|
-
when %r{application/xml}
|
376
|
+
else # when %r{application/xml}
|
378
377
|
record = from_xml response.body
|
379
378
|
record.instance_eval { @etag, @response = response['ETag'], response }
|
380
379
|
record
|
381
|
-
else
|
382
|
-
raise Recurly::Error, "Content-Type \"#{content_type}\" is not accepted"
|
383
380
|
end
|
384
381
|
end
|
385
382
|
|
@@ -393,11 +390,10 @@ module Recurly
|
|
393
390
|
# @see from_response
|
394
391
|
def from_xml(xml)
|
395
392
|
xml = XML.new xml
|
393
|
+
|
396
394
|
if self != Resource || xml.name == member_name
|
397
395
|
record = new
|
398
|
-
elsif Recurly.const_defined?(
|
399
|
-
class_name = Helper.classify(xml.name), false
|
400
|
-
)
|
396
|
+
elsif Recurly.const_defined?(class_name = Helper.classify(xml.name), false)
|
401
397
|
klass = Recurly.const_get class_name, false
|
402
398
|
record = klass.send :new
|
403
399
|
elsif root = xml.root and root.elements.empty?
|
@@ -447,13 +443,24 @@ module Recurly
|
|
447
443
|
}
|
448
444
|
end
|
449
445
|
else
|
450
|
-
|
451
|
-
if
|
452
|
-
|
453
|
-
|
454
|
-
record[el.name] =
|
446
|
+
# TODO name tax_type conflicts with the TaxType
|
447
|
+
# class so if we get to this point was can assume
|
448
|
+
# it's the string. Will need to refactor this
|
449
|
+
if el.name == 'tax_type'
|
450
|
+
record[el.name] = el.text
|
455
451
|
else
|
456
|
-
|
452
|
+
val = XML.cast(el)
|
453
|
+
|
454
|
+
# TODO we have to clear changed attributes after
|
455
|
+
# parsing here or else it always serializes. Need
|
456
|
+
# a better way of handling changed attributes
|
457
|
+
if el.name == 'address' && val.kind_of?(Hash)
|
458
|
+
address = Address.new val
|
459
|
+
address.changed_attributes.clear
|
460
|
+
record[el.name] = address
|
461
|
+
else
|
462
|
+
record[el.name] = val
|
463
|
+
end
|
457
464
|
end
|
458
465
|
end
|
459
466
|
end
|
@@ -622,12 +629,9 @@ module Recurly
|
|
622
629
|
return if response.body.to_s.length.zero?
|
623
630
|
fresh = self.class.from_response response
|
624
631
|
else
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
else
|
629
|
-
self.class.find(to_param, options)
|
630
|
-
end
|
632
|
+
fresh = self.class.find(
|
633
|
+
@href || to_param, :etag => (etag unless changed?)
|
634
|
+
)
|
631
635
|
end
|
632
636
|
fresh and copy_from fresh
|
633
637
|
persist! true
|
@@ -748,10 +752,6 @@ module Recurly
|
|
748
752
|
}
|
749
753
|
end
|
750
754
|
|
751
|
-
def as_json(options = nil)
|
752
|
-
attributes.reject { |k, v| v.is_a?(Recurly::Resource::Pager) }
|
753
|
-
end
|
754
|
-
|
755
755
|
# @return [Hash] The raw hash of record href links.
|
756
756
|
def links
|
757
757
|
@links ||= {}
|
data/lib/recurly/usage.rb
CHANGED
data/lib/recurly/version.rb
CHANGED
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.6.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
26
|
version: 1.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 11.1.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 11.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 5.8.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 5.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: addressable
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.4.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.4.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.24.6
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.24.6
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: redcarpet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: racc
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: pry
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: 'An API client library for Recurly: http://recurly.com'
|
@@ -144,21 +144,18 @@ extensions: []
|
|
144
144
|
extra_rdoc_files:
|
145
145
|
- README.md
|
146
146
|
files:
|
147
|
-
- README.md
|
148
|
-
- bin/recurly
|
149
147
|
- lib/ecurly.rb
|
150
148
|
- lib/rails/generators/recurly/config_generator.rb
|
151
149
|
- lib/rails/recurly.rb
|
152
|
-
- lib/recurly.rb
|
153
150
|
- lib/recurly/account.rb
|
154
151
|
- lib/recurly/account_balance.rb
|
155
152
|
- lib/recurly/add_on.rb
|
156
153
|
- lib/recurly/address.rb
|
157
154
|
- lib/recurly/adjustment.rb
|
158
155
|
- lib/recurly/all.rb
|
159
|
-
- lib/recurly/api.rb
|
160
156
|
- lib/recurly/api/errors.rb
|
161
157
|
- lib/recurly/api/net_http_adapter.rb
|
158
|
+
- lib/recurly/api.rb
|
162
159
|
- lib/recurly/billing_info.rb
|
163
160
|
- lib/recurly/coupon.rb
|
164
161
|
- lib/recurly/delivery.rb
|
@@ -167,24 +164,25 @@ files:
|
|
167
164
|
- lib/recurly/helper.rb
|
168
165
|
- lib/recurly/invoice.rb
|
169
166
|
- lib/recurly/js.rb
|
167
|
+
- lib/recurly/juris_detail.rb
|
170
168
|
- lib/recurly/measured_unit.rb
|
171
169
|
- lib/recurly/money.rb
|
172
170
|
- lib/recurly/plan.rb
|
173
171
|
- lib/recurly/redemption.rb
|
174
|
-
- lib/recurly/resource.rb
|
175
172
|
- lib/recurly/resource/association.rb
|
176
173
|
- lib/recurly/resource/errors.rb
|
177
174
|
- lib/recurly/resource/pager.rb
|
175
|
+
- lib/recurly/resource.rb
|
178
176
|
- lib/recurly/shipping_address.rb
|
179
|
-
- lib/recurly/subscription.rb
|
180
177
|
- lib/recurly/subscription/add_ons.rb
|
178
|
+
- lib/recurly/subscription.rb
|
181
179
|
- lib/recurly/subscription_add_on.rb
|
182
180
|
- lib/recurly/tax_detail.rb
|
183
|
-
- lib/recurly/
|
181
|
+
- lib/recurly/tax_type.rb
|
184
182
|
- lib/recurly/transaction/errors.rb
|
183
|
+
- lib/recurly/transaction.rb
|
185
184
|
- lib/recurly/usage.rb
|
186
185
|
- lib/recurly/version.rb
|
187
|
-
- lib/recurly/webhook.rb
|
188
186
|
- lib/recurly/webhook/account_notification.rb
|
189
187
|
- lib/recurly/webhook/billing_info_updated_notification.rb
|
190
188
|
- lib/recurly/webhook/canceled_account_notification.rb
|
@@ -211,33 +209,38 @@ files:
|
|
211
209
|
- lib/recurly/webhook/transaction_notification.rb
|
212
210
|
- lib/recurly/webhook/updated_subscription_notification.rb
|
213
211
|
- lib/recurly/webhook/void_payment_notification.rb
|
214
|
-
- lib/recurly/
|
212
|
+
- lib/recurly/webhook.rb
|
215
213
|
- lib/recurly/xml/nokogiri.rb
|
216
214
|
- lib/recurly/xml/rexml.rb
|
215
|
+
- lib/recurly/xml.rb
|
216
|
+
- lib/recurly.rb
|
217
|
+
- README.md
|
218
|
+
- bin/recurly
|
217
219
|
homepage: https://github.com/recurly/recurly-client-ruby
|
218
220
|
licenses:
|
219
221
|
- MIT
|
220
222
|
metadata: {}
|
221
223
|
post_install_message:
|
222
224
|
rdoc_options:
|
223
|
-
-
|
225
|
+
- --main
|
224
226
|
- README.md
|
225
227
|
require_paths:
|
226
228
|
- lib
|
227
229
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
230
|
requirements:
|
229
|
-
- -
|
231
|
+
- - '>='
|
230
232
|
- !ruby/object:Gem::Version
|
231
233
|
version: 1.9.3
|
232
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
235
|
requirements:
|
234
|
-
- -
|
236
|
+
- - '>'
|
235
237
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
238
|
+
version: 1.3.1
|
237
239
|
requirements: []
|
238
240
|
rubyforge_project:
|
239
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.0.14.1
|
240
242
|
signing_key:
|
241
243
|
specification_version: 4
|
242
244
|
summary: Recurly API Client
|
243
245
|
test_files: []
|
246
|
+
has_rdoc: true
|