recurly 2.2.6 → 2.3.0
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 +13 -5
- data/README.md +1 -1
- data/lib/recurly.rb +1 -18
- data/lib/recurly/account.rb +1 -0
- data/lib/recurly/address.rb +1 -1
- data/lib/recurly/adjustment.rb +2 -1
- data/lib/recurly/api.rb +0 -8
- data/lib/recurly/api/net_http_adapter.rb +1 -2
- data/lib/recurly/invoice.rb +2 -0
- data/lib/recurly/plan.rb +1 -0
- data/lib/recurly/resource.rb +5 -9
- data/lib/recurly/subscription.rb +19 -0
- data/lib/recurly/tax_detail.rb +14 -0
- data/lib/recurly/version.rb +2 -2
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWZhMjQwMTY2MDFjMWZhZjk5NWQ5OTYzOGYxZjdhYWFkZDIxOTYwYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OWRhNjkwMjAwOTAzYTA0OTY0MDE1Mzg3Y2QwMTE2YmE1OWQ1NDBiMg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjMwMjRjNjkwNTliZjlkODBmNDE5MTY4ZjYzZTY3ODFmMTlmOGJmZTU0MzM4
|
10
|
+
YjY0ZGRlMTkyZjAyZTcwMDg3ZDdkMDdmMzRiNDMyZmNlMTk3ZTc1MzIxNzlm
|
11
|
+
MThiZDU4ZWFiYjRhZWMwZTQwMGVkM2MzMzliNTIxY2IwZGY5MGM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTkyZmRkYWE0NjY2MDkwZDViOTQ2YzNjMjUwNmVkYmVhNzI2Y2I4MmQzN2Iw
|
14
|
+
M2Q0Nzk4MzI0ZmRiODE0MWVjYWFiMDE1Zjc4ZjlmY2EyZDVkZTBkZjkxODI0
|
15
|
+
OTRjOGMwYmI1MGQyZWVjMjZmZWY4NDAyMGE1NzlkZTA1ZDJkMDA=
|
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.
|
15
|
+
gem 'recurly', '~> 2.3.0'
|
16
16
|
```
|
17
17
|
|
18
18
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly.rb
CHANGED
@@ -3,6 +3,7 @@ module Recurly
|
|
3
3
|
autoload :Account, 'recurly/account'
|
4
4
|
autoload :AddOn, 'recurly/add_on'
|
5
5
|
autoload :Address, 'recurly/address'
|
6
|
+
autoload :TaxDetail, 'recurly/tax_detail'
|
6
7
|
autoload :Adjustment, 'recurly/adjustment'
|
7
8
|
autoload :API, 'recurly/api'
|
8
9
|
autoload :BillingInfo, 'recurly/billing_info'
|
@@ -67,8 +68,6 @@ module Recurly
|
|
67
68
|
end
|
68
69
|
|
69
70
|
# Assigns a logger to log requests/responses and more.
|
70
|
-
# The logger can only be set if the environment variable
|
71
|
-
# `RECURLY_INSECURE_DEBUG` equals `true`.
|
72
71
|
#
|
73
72
|
# @return [Logger, nil]
|
74
73
|
# @example
|
@@ -80,22 +79,6 @@ module Recurly
|
|
80
79
|
# Recurly.logger = nil # Or Recurly.logger = Logger.new nil
|
81
80
|
attr_accessor :logger
|
82
81
|
|
83
|
-
def logger=(logger)
|
84
|
-
if ENV['RECURLY_INSECURE_DEBUG'].to_s.downcase == 'true'
|
85
|
-
@logger = logger
|
86
|
-
puts <<-MSG
|
87
|
-
[WARNING] Recurly logger enabled. The logger has the potential to leak
|
88
|
-
PII and should never be used in production environments.
|
89
|
-
MSG
|
90
|
-
else
|
91
|
-
puts <<-MSG
|
92
|
-
[WARNING] Recurly logger has been disabled. If you wish to use it,
|
93
|
-
only do so in a non-production environment and make sure
|
94
|
-
the `RECURLY_INSECURE_DEBUG` environment variable is set to `true`.
|
95
|
-
MSG
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
82
|
# Convenience logging method includes a Logger#progname dynamically.
|
100
83
|
# @return [true, nil]
|
101
84
|
def log level, message
|
data/lib/recurly/account.rb
CHANGED
data/lib/recurly/address.rb
CHANGED
data/lib/recurly/adjustment.rb
CHANGED
data/lib/recurly/api.rb
CHANGED
@@ -15,7 +15,6 @@ 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
19
|
FORMATS = Helper.hash_with_indifferent_read_access(
|
21
20
|
'pdf' => 'application/pdf',
|
@@ -74,13 +73,6 @@ module Recurly
|
|
74
73
|
URI.parse @@base_uri.sub('api', Recurly.subdomain)
|
75
74
|
end
|
76
75
|
|
77
|
-
def validate_uri!(uri)
|
78
|
-
domain = @@valid_domains.detect { |d| uri.host.end_with?(d) }
|
79
|
-
unless domain
|
80
|
-
raise ArgumentError, "URI #{uri} is invalid. You may only make requests to a Recurly domain."
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
76
|
# @return [String]
|
85
77
|
def user_agent
|
86
78
|
"Recurly/#{Version}; #{RUBY_DESCRIPTION}"
|
@@ -36,14 +36,13 @@ module Recurly
|
|
36
36
|
head = headers.dup
|
37
37
|
head.update options[:head] if options[:head]
|
38
38
|
head.delete_if { |_, value| value.nil? }
|
39
|
-
uri = base_uri + uri
|
39
|
+
uri = base_uri + URI.escape(uri)
|
40
40
|
if options[:params] && !options[:params].empty?
|
41
41
|
pairs = options[:params].map { |key, value|
|
42
42
|
"#{CGI.escape key.to_s}=#{CGI.escape value.to_s}"
|
43
43
|
}
|
44
44
|
uri += "?#{pairs.join '&'}"
|
45
45
|
end
|
46
|
-
self.validate_uri!(uri)
|
47
46
|
request = METHODS[method].new uri.request_uri, head
|
48
47
|
request.basic_auth(*[Recurly.api_key, nil].flatten[0, 2])
|
49
48
|
if options[:body]
|
data/lib/recurly/invoice.rb
CHANGED
data/lib/recurly/plan.rb
CHANGED
data/lib/recurly/resource.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'date'
|
2
|
-
require 'erb'
|
3
2
|
|
4
3
|
module Recurly
|
5
4
|
# The base class for all Recurly resources (e.g. {Account}, {Subscription},
|
@@ -185,7 +184,6 @@ module Recurly
|
|
185
184
|
# Recurly::Account.member_path "code" # => "accounts/code"
|
186
185
|
# Recurly::Account.member_path nil # => "accounts"
|
187
186
|
def member_path uuid
|
188
|
-
uuid = ERB::Util.url_encode(uuid) if uuid
|
189
187
|
[collection_path, uuid].compact.join '/'
|
190
188
|
end
|
191
189
|
|
@@ -321,8 +319,9 @@ module Recurly
|
|
321
319
|
raise NotFound, "can't find a record with nil identifier"
|
322
320
|
end
|
323
321
|
|
322
|
+
uri = uuid =~ /^http/ ? uuid : member_path(uuid)
|
324
323
|
begin
|
325
|
-
from_response API.get(
|
324
|
+
from_response API.get(uri, {}, options)
|
326
325
|
rescue API::NotFound => e
|
327
326
|
raise NotFound, e.description
|
328
327
|
end
|
@@ -559,12 +558,9 @@ module Recurly
|
|
559
558
|
return if response.body.to_s.length.zero?
|
560
559
|
fresh = self.class.from_response response
|
561
560
|
else
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
else
|
566
|
-
self.class.find(to_param, options)
|
567
|
-
end
|
561
|
+
fresh = self.class.find(
|
562
|
+
@href || to_param, :etag => (etag unless changed?)
|
563
|
+
)
|
568
564
|
end
|
569
565
|
fresh and copy_from fresh
|
570
566
|
persist! true
|
data/lib/recurly/subscription.rb
CHANGED
@@ -2,6 +2,8 @@ module Recurly
|
|
2
2
|
class Subscription < Resource
|
3
3
|
autoload :AddOns, 'recurly/subscription/add_ons'
|
4
4
|
|
5
|
+
class NotPreviewableError < StandardError; end
|
6
|
+
|
5
7
|
# @macro [attach] scope
|
6
8
|
# @scope class
|
7
9
|
# @return [Pager<Subscription>] A pager that yields +$1+ subscriptions.
|
@@ -45,9 +47,26 @@ module Recurly
|
|
45
47
|
net_terms
|
46
48
|
collection_method
|
47
49
|
po_number
|
50
|
+
tax_in_cents
|
51
|
+
tax_type
|
52
|
+
tax_rate
|
48
53
|
)
|
49
54
|
alias to_param uuid
|
50
55
|
|
56
|
+
def self.preview(attributes = {})
|
57
|
+
new(attributes) { |record| record.preview }
|
58
|
+
end
|
59
|
+
|
60
|
+
def preview
|
61
|
+
raise NotPreviewableError.new('Cannot preview an existing subscription') unless new_record?
|
62
|
+
|
63
|
+
clear_errors
|
64
|
+
@response = API.send(:post, "#{path}/preview", to_xml)
|
65
|
+
reload response
|
66
|
+
rescue API::UnprocessableEntity => e
|
67
|
+
apply_errors e
|
68
|
+
end
|
69
|
+
|
51
70
|
# @return [Subscription] A new subscription.
|
52
71
|
def initialize attributes = {}
|
53
72
|
super({ :currency => Recurly.default_currency }.merge attributes)
|
data/lib/recurly/version.rb
CHANGED
metadata
CHANGED
@@ -1,58 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
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: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.9.2
|
20
20
|
type: :development
|
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: 0.9.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.6.1
|
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: 2.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.7.6
|
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: 1.7.6
|
55
|
-
description: 'An API client library for Recurly: http://recurly.com'
|
55
|
+
description: ! 'An API client library for Recurly: http://recurly.com'
|
56
56
|
email: support@recurly.com
|
57
57
|
executables:
|
58
58
|
- recurly
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/recurly/subscription.rb
|
89
89
|
- lib/recurly/subscription/add_ons.rb
|
90
90
|
- lib/recurly/subscription_add_on.rb
|
91
|
+
- lib/recurly/tax_detail.rb
|
91
92
|
- lib/recurly/transaction.rb
|
92
93
|
- lib/recurly/transaction/errors.rb
|
93
94
|
- lib/recurly/version.rb
|
@@ -100,24 +101,25 @@ licenses:
|
|
100
101
|
metadata: {}
|
101
102
|
post_install_message:
|
102
103
|
rdoc_options:
|
103
|
-
-
|
104
|
+
- --main
|
104
105
|
- README.md
|
105
106
|
require_paths:
|
106
107
|
- lib
|
107
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
109
|
requirements:
|
109
|
-
- -
|
110
|
+
- - ! '>='
|
110
111
|
- !ruby/object:Gem::Version
|
111
112
|
version: 1.9.3
|
112
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - ! '>='
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
requirements: []
|
118
119
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.2.2
|
120
121
|
signing_key:
|
121
122
|
specification_version: 4
|
122
123
|
summary: Recurly API Client
|
123
124
|
test_files: []
|
125
|
+
has_rdoc: true
|