recurly 2.5.1 → 2.5.2
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 +25 -33
- data/lib/recurly/add_on.rb +5 -0
- data/lib/recurly/api.rb +1 -1
- data/lib/recurly/error.rb +13 -0
- data/lib/recurly/measured_unit.rb +12 -0
- data/lib/recurly/resource.rb +15 -4
- data/lib/recurly/resource/pager.rb +11 -0
- data/lib/recurly/subscription.rb +1 -1
- data/lib/recurly/subscription_add_on.rb +10 -0
- data/lib/recurly/transaction.rb +1 -0
- data/lib/recurly/usage.rb +23 -0
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly/xml/nokogiri.rb +1 -1
- metadata +30 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2262959571c90e57a28e1e23e8b43752d9bdc4b
|
4
|
+
data.tar.gz: f330f72ffa67ab66906bb85413fc9f26ec56932d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6acb8408b5370b56c46086b701d19f5aefa7a23d4dd73c89c5962012bd27b1c8bb087980125ec651280b6aa132ac8973ff0058a8befd5d7c812a4107c82321e8
|
7
|
+
data.tar.gz: 9dce505a4d1c0944b21ced09d53dda21aeb75428fc9d182c932efc92fcac00f31ca934aa0f6ef8ed833a1646106fd9eb18f04eb96215784d6d8f504b3bac93d5
|
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.5.
|
15
|
+
gem 'recurly', '~> 2.5.2'
|
16
16
|
```
|
17
17
|
|
18
18
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly.rb
CHANGED
@@ -1,41 +1,33 @@
|
|
1
1
|
# Recurly is a Ruby client for Recurly's REST API.
|
2
2
|
module Recurly
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
3
|
+
require 'recurly/error'
|
4
|
+
require 'recurly/helper'
|
5
|
+
require 'recurly/api'
|
6
|
+
require 'recurly/resource'
|
7
|
+
require 'recurly/billing_info'
|
8
|
+
require 'recurly/account'
|
9
|
+
require 'recurly/add_on'
|
10
|
+
require 'recurly/address'
|
11
|
+
require 'recurly/tax_detail'
|
12
|
+
require 'recurly/adjustment'
|
13
|
+
require 'recurly/coupon'
|
14
|
+
require 'recurly/helper'
|
15
|
+
require 'recurly/invoice'
|
16
|
+
require 'recurly/js'
|
17
|
+
require 'recurly/money'
|
18
|
+
require 'recurly/measured_unit'
|
19
|
+
require 'recurly/plan'
|
20
|
+
require 'recurly/redemption'
|
21
|
+
require 'recurly/subscription'
|
22
|
+
require 'recurly/subscription_add_on'
|
23
|
+
require 'recurly/transaction'
|
24
|
+
require 'recurly/usage'
|
25
|
+
require 'recurly/version'
|
26
|
+
require 'recurly/xml'
|
27
|
+
require 'recurly/webhook'
|
24
28
|
|
25
29
|
@subdomain = nil
|
26
30
|
|
27
|
-
# The exception class from which all Recurly exceptions inherit.
|
28
|
-
class Error < StandardError
|
29
|
-
def set_message message
|
30
|
-
@message = message
|
31
|
-
end
|
32
|
-
|
33
|
-
# @return [String]
|
34
|
-
def to_s
|
35
|
-
defined? @message and @message or super
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
31
|
# This exception is raised if Recurly has not been configured.
|
40
32
|
class ConfigurationError < Error
|
41
33
|
end
|
data/lib/recurly/add_on.rb
CHANGED
data/lib/recurly/api.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Recurly
|
2
|
+
# The exception class from which all Recurly exceptions inherit.
|
3
|
+
class Error < StandardError
|
4
|
+
def set_message message
|
5
|
+
@message = message
|
6
|
+
end
|
7
|
+
|
8
|
+
# @return [String]
|
9
|
+
def to_s
|
10
|
+
defined? @message and @message or super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/recurly/resource.rb
CHANGED
@@ -114,9 +114,9 @@ module Recurly
|
|
114
114
|
#
|
115
115
|
# Account.find_each { |account| p account }
|
116
116
|
class Resource
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
require 'recurly/resource/errors'
|
118
|
+
require 'recurly/resource/pager'
|
119
|
+
require 'recurly/resource/association'
|
120
120
|
|
121
121
|
# Raised when a record cannot be found.
|
122
122
|
#
|
@@ -316,6 +316,12 @@ module Recurly
|
|
316
316
|
# @example
|
317
317
|
# Recurly::Account.find "heisenberg"
|
318
318
|
# # => #<Recurly::Account account_code: "heisenberg", ...>
|
319
|
+
# Use the following identifiers for these types of objects:
|
320
|
+
# for accounts use account_code
|
321
|
+
# for plans use plan_code
|
322
|
+
# for invoices use invoice_number
|
323
|
+
# for subscriptions use uuid
|
324
|
+
# for transactions use uuid
|
319
325
|
def find uuid, options = {}
|
320
326
|
if uuid.nil?
|
321
327
|
# Should we raise an ArgumentError, instead?
|
@@ -401,7 +407,12 @@ module Recurly
|
|
401
407
|
}
|
402
408
|
next
|
403
409
|
end
|
404
|
-
|
410
|
+
|
411
|
+
# Nokogiri on Jruby-1.7.19 likes to throw NullPointer exceptions
|
412
|
+
# if you try to run certian operations like el.attribute(''). Since
|
413
|
+
# 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
|
+
|
405
416
|
if el.children.empty? && href = el.attribute('href')
|
406
417
|
klass_name = Helper.classify(klass.association_class_name(el.name) ||
|
407
418
|
el.attribute('type') ||
|
@@ -156,6 +156,17 @@ module Recurly
|
|
156
156
|
new(attributes) { |record| record.save }
|
157
157
|
end
|
158
158
|
|
159
|
+
# Instantiates a record in the scope of the pager.
|
160
|
+
#
|
161
|
+
# @return [Resource] The record.
|
162
|
+
# @example
|
163
|
+
# account = Recurly::Account.find 'schrader'
|
164
|
+
# subscription = account.subscriptions.build attributes
|
165
|
+
# @see Resource.new
|
166
|
+
def build attributes = {}
|
167
|
+
new(attributes)
|
168
|
+
end
|
169
|
+
|
159
170
|
# Instantiates and saves a record in the scope of the pager.
|
160
171
|
#
|
161
172
|
# @return [Resource] The saved record.
|
data/lib/recurly/subscription.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
module Recurly
|
2
2
|
class SubscriptionAddOn < Resource
|
3
|
+
# @return [MeasuredUnit]
|
4
|
+
has_one :measured_unit
|
5
|
+
|
6
|
+
# Singular because the endpoint is /usage not /usages
|
7
|
+
# @return [Usage]
|
8
|
+
has_many :usage
|
9
|
+
|
3
10
|
define_attribute_methods %w(
|
4
11
|
add_on_code
|
5
12
|
quantity
|
6
13
|
unit_amount_in_cents
|
14
|
+
add_on_type
|
15
|
+
usage_type
|
16
|
+
usage_percentage
|
7
17
|
)
|
8
18
|
|
9
19
|
attr_reader :subscription
|
data/lib/recurly/transaction.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Recurly
|
2
|
+
class Usage < Resource
|
3
|
+
# @return [MeasuredUnit]
|
4
|
+
belongs_to :measured_unit
|
5
|
+
|
6
|
+
define_attribute_methods %w(
|
7
|
+
usage_type
|
8
|
+
unit_amount_in_cents
|
9
|
+
usage_percentage
|
10
|
+
amount
|
11
|
+
merchant_tag
|
12
|
+
usage_timestamp
|
13
|
+
recording_timestamp
|
14
|
+
billed_at
|
15
|
+
created_at
|
16
|
+
updated_at
|
17
|
+
)
|
18
|
+
|
19
|
+
# Usages are only writeable and readable through {SubscriptionAddOns} instances.
|
20
|
+
embedded!
|
21
|
+
private_class_method :find
|
22
|
+
end
|
23
|
+
end
|
data/lib/recurly/version.rb
CHANGED
data/lib/recurly/xml/nokogiri.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-05-02 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
|
-
version:
|
19
|
+
version: '11.1'
|
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
|
-
version:
|
26
|
+
version: '11.1'
|
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
|
-
version:
|
33
|
+
version: '5.8'
|
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
|
-
version:
|
40
|
+
version: '5.8'
|
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
|
-
version: 1.
|
47
|
+
version: '1.24'
|
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
|
-
version: 1.
|
54
|
+
version: '1.24'
|
55
55
|
description: 'An API client library for Recurly: http://recurly.com'
|
56
56
|
email: support@recurly.com
|
57
57
|
executables:
|
@@ -60,40 +60,39 @@ extensions: []
|
|
60
60
|
extra_rdoc_files:
|
61
61
|
- README.md
|
62
62
|
files:
|
63
|
-
- README.md
|
64
|
-
- bin/recurly
|
65
63
|
- lib/ecurly.rb
|
66
64
|
- lib/rails/generators/recurly/config_generator.rb
|
67
65
|
- lib/rails/recurly.rb
|
68
|
-
- lib/recurly.rb
|
69
66
|
- lib/recurly/account.rb
|
70
67
|
- lib/recurly/add_on.rb
|
71
68
|
- lib/recurly/address.rb
|
72
69
|
- lib/recurly/adjustment.rb
|
73
70
|
- lib/recurly/all.rb
|
74
|
-
- lib/recurly/api.rb
|
75
71
|
- lib/recurly/api/errors.rb
|
76
72
|
- lib/recurly/api/net_http_adapter.rb
|
73
|
+
- lib/recurly/api.rb
|
77
74
|
- lib/recurly/billing_info.rb
|
78
75
|
- lib/recurly/coupon.rb
|
76
|
+
- lib/recurly/error.rb
|
79
77
|
- lib/recurly/helper.rb
|
80
78
|
- lib/recurly/invoice.rb
|
81
79
|
- lib/recurly/js.rb
|
80
|
+
- lib/recurly/measured_unit.rb
|
82
81
|
- lib/recurly/money.rb
|
83
82
|
- lib/recurly/plan.rb
|
84
83
|
- lib/recurly/redemption.rb
|
85
|
-
- lib/recurly/resource.rb
|
86
84
|
- lib/recurly/resource/association.rb
|
87
85
|
- lib/recurly/resource/errors.rb
|
88
86
|
- lib/recurly/resource/pager.rb
|
89
|
-
- lib/recurly/
|
87
|
+
- lib/recurly/resource.rb
|
90
88
|
- lib/recurly/subscription/add_ons.rb
|
89
|
+
- lib/recurly/subscription.rb
|
91
90
|
- lib/recurly/subscription_add_on.rb
|
92
91
|
- lib/recurly/tax_detail.rb
|
93
|
-
- lib/recurly/transaction.rb
|
94
92
|
- lib/recurly/transaction/errors.rb
|
93
|
+
- lib/recurly/transaction.rb
|
94
|
+
- lib/recurly/usage.rb
|
95
95
|
- lib/recurly/version.rb
|
96
|
-
- lib/recurly/webhook.rb
|
97
96
|
- lib/recurly/webhook/account_notification.rb
|
98
97
|
- lib/recurly/webhook/billing_info_updated_notification.rb
|
99
98
|
- lib/recurly/webhook/canceled_account_notification.rb
|
@@ -118,32 +117,36 @@ files:
|
|
118
117
|
- lib/recurly/webhook/transaction_notification.rb
|
119
118
|
- lib/recurly/webhook/updated_subscription_notification.rb
|
120
119
|
- lib/recurly/webhook/void_payment_notification.rb
|
121
|
-
- lib/recurly/
|
120
|
+
- lib/recurly/webhook.rb
|
122
121
|
- lib/recurly/xml/nokogiri.rb
|
123
122
|
- lib/recurly/xml/rexml.rb
|
123
|
+
- lib/recurly/xml.rb
|
124
|
+
- lib/recurly.rb
|
125
|
+
- README.md
|
126
|
+
- bin/recurly
|
124
127
|
homepage: https://github.com/recurly/recurly-client-ruby
|
125
128
|
licenses:
|
126
129
|
- MIT
|
127
130
|
metadata: {}
|
128
131
|
post_install_message:
|
129
132
|
rdoc_options:
|
130
|
-
-
|
133
|
+
- --main
|
131
134
|
- README.md
|
132
135
|
require_paths:
|
133
136
|
- lib
|
134
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
138
|
requirements:
|
136
|
-
- -
|
139
|
+
- - '>='
|
137
140
|
- !ruby/object:Gem::Version
|
138
141
|
version: 1.9.3
|
139
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
143
|
requirements:
|
141
|
-
- -
|
144
|
+
- - '>='
|
142
145
|
- !ruby/object:Gem::Version
|
143
146
|
version: '0'
|
144
147
|
requirements: []
|
145
148
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.0.14.1
|
147
150
|
signing_key:
|
148
151
|
specification_version: 4
|
149
152
|
summary: Recurly API Client
|