recurly 0.3.3 → 0.3.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.
- data/README.md +15 -11
- data/lib/patches/active_resource/connection.rb +10 -0
- data/lib/recurly.rb +35 -9
- data/lib/recurly/account.rb +22 -1
- data/lib/recurly/account_base.rb +35 -0
- data/lib/recurly/base.rb +26 -39
- data/lib/recurly/billing_info.rb +40 -1
- data/lib/recurly/charge.rb +12 -1
- data/lib/recurly/coupon.rb +8 -0
- data/lib/recurly/credit.rb +12 -1
- data/lib/recurly/exceptions.rb +19 -0
- data/lib/recurly/invoice.rb +1 -1
- data/lib/recurly/plan.rb +13 -1
- data/lib/recurly/rails3/recurly.rake +5 -3
- data/lib/recurly/subscription.rb +21 -3
- data/lib/recurly/transaction.rb +29 -1
- data/lib/recurly/transparent.rb +140 -0
- data/lib/recurly/version.rb +1 -1
- data/spec/config/recurly.yml +12 -0
- data/spec/config/test1.yml +3 -1
- data/spec/config/test2.yml +4 -2
- data/spec/integration/credit_spec.rb +6 -6
- data/spec/integration/plan_spec.rb +2 -2
- data/spec/support/factory.rb +5 -3
- data/spec/unit/account_spec.rb +19 -0
- data/spec/unit/billing_info_spec.rb +38 -0
- data/spec/unit/charge_spec.rb +18 -0
- data/spec/unit/config_spec.rb +10 -6
- data/spec/unit/coupon_spec.rb +13 -0
- data/spec/unit/credit_spec.rb +18 -0
- data/spec/unit/plan_spec.rb +18 -0
- data/spec/unit/subscription_spec.rb +25 -0
- data/spec/unit/transaction_spec.rb +32 -0
- data/spec/unit/transparent_spec.rb +114 -0
- data/spec/vcr/account/accept-language-account/{1296674173.yml → 1297746103.yml} +16 -13
- data/spec/vcr/account/close/{1296674173.yml → 1297746103.yml} +31 -28
- data/spec/vcr/account/create-blank/{1296674173.yml → 1297746103.yml} +9 -5
- data/spec/vcr/account/create-duplicate/{1296674173.yml → 1297746103.yml} +22 -15
- data/spec/vcr/account/create-min/{1296674173.yml → 1297746103.yml} +16 -13
- data/spec/vcr/account/create/{1296674173.yml → 1297746103.yml} +16 -13
- data/spec/vcr/account/find/{1296674173.yml → 1297746103.yml} +29 -26
- data/spec/vcr/account/list/1297746103.yml +1579 -0
- data/spec/vcr/account/update/{1296674173.yml → 1297746103.yml} +54 -47
- data/spec/vcr/billing/create/{1296690812.yml → 1298594128.yml} +37 -34
- data/spec/vcr/billing/destroy/{1296690812.yml → 1298594128.yml} +46 -43
- data/spec/vcr/billing/find/{1296690812.yml → 1298594128.yml} +47 -44
- data/spec/vcr/billing/update/{1296690812.yml → 1298594128.yml} +50 -47
- data/spec/vcr/charge/create/{1296674173.yml → 1297746103.yml} +48 -45
- data/spec/vcr/charge/delete-uninvoiced/{1296674173.yml → 1297746103.yml} +49 -46
- data/spec/vcr/charge/list-all/{1296674173.yml → 1297746103.yml} +61 -58
- data/spec/vcr/charge/list-invoiced/{1296674173.yml → 1297746103.yml} +92 -89
- data/spec/vcr/charge/list-pending/{1296674173.yml → 1297746103.yml} +61 -58
- data/spec/vcr/charge/lookup/{1296674173.yml → 1297746103.yml} +34 -31
- data/spec/vcr/coupon/create/{1296774903.yml → 1299714521.yml} +35 -32
- data/spec/vcr/coupon/destroy/{1296688818.yml → 1299714521.yml} +34 -31
- data/spec/vcr/{coupon/create/1296688818.yml → credit/create/1299714599.yml} +53 -53
- data/spec/vcr/credit/delete/1299714599.yml +262 -0
- data/spec/vcr/credit/list/1299714599.yml +319 -0
- data/spec/vcr/credit/lookup/1299714599.yml +183 -0
- data/spec/vcr/invoice/create-no-charges/{1296674173.yml → 1297746103.yml} +34 -31
- data/spec/vcr/invoice/create/{1296674173.yml → 1297746103.yml} +63 -60
- data/spec/vcr/invoice/list/{1296674173.yml → 1297746103.yml} +87 -84
- data/spec/vcr/invoice/lookup/{1296674173.yml → 1297746103.yml} +64 -61
- data/spec/vcr/plan/all.yml +30 -30
- data/spec/vcr/plan/find.yml +25 -25
- data/spec/vcr/plan/update.yml +16 -15
- data/spec/vcr/subscription/addons/add/{1296674173.yml → 1297746103.yml} +44 -40
- data/spec/vcr/subscription/addons/create/{1296674173.yml → 1297746103.yml} +44 -40
- data/spec/vcr/subscription/addons/remove/{1296674173.yml → 1297746103.yml} +44 -40
- data/spec/vcr/subscription/cancel-with-code/{1296674173.yml → 1297746103.yml} +99 -95
- data/spec/vcr/subscription/cancel/{1296674173.yml → 1297746103.yml} +86 -82
- data/spec/vcr/subscription/change1/{1296674173.yml → 1297746103.yml} +82 -78
- data/spec/vcr/subscription/change2/{1296674173.yml → 1297746103.yml} +82 -78
- data/spec/vcr/subscription/create/{1296674173.yml → 1297746103.yml} +49 -45
- data/spec/vcr/subscription/find/{1296674173.yml → 1297746103.yml} +60 -56
- data/spec/vcr/subscription/reactivate/{1296674173.yml → 1297746103.yml} +93 -89
- data/spec/vcr/subscription/refund-full/{1296674173.yml → 1297746103.yml} +77 -73
- data/spec/vcr/subscription/refund-none/{1296674173.yml → 1297746103.yml} +77 -73
- data/spec/vcr/subscription/refund-partial/{1296674173.yml → 1297746103.yml} +77 -73
- data/spec/vcr/transaction/all/{1296674173.yml → 1297746103.yml} +107 -107
- data/spec/vcr/transaction/create-no-account/{1296674173.yml → 1297746103.yml} +14 -13
- data/spec/vcr/transaction/create-with-account/{1296674173.yml → 1297746103.yml} +46 -58
- data/spec/vcr/transaction/list-filled/1297746103.yml +213 -0
- data/spec/vcr/transaction/list-initial/{1296674173.yml → 1297746103.yml} +38 -35
- data/spec/vcr/transaction/lookup/1297746103.yml +213 -0
- data/spec/vcr/transaction/refund/1297746103.yml +213 -0
- data/spec/vcr/transaction/void/1297746103.yml +213 -0
- metadata +146 -139
- data/spec/vcr/account/list/1296674173.yml +0 -55
- data/spec/vcr/coupon/destroy/1296774903.yml +0 -207
- data/spec/vcr/credit/create/1296674173.yml +0 -121
- data/spec/vcr/credit/delete/1296674173.yml +0 -121
- data/spec/vcr/credit/list/1296674173.yml +0 -121
- data/spec/vcr/credit/lookup/1296674173.yml +0 -121
- data/spec/vcr/plan/delete/1296674173.yml +0 -225
- data/spec/vcr/transaction/list-filled/1296674173.yml +0 -487
- data/spec/vcr/transaction/lookup/1296674173.yml +0 -563
- data/spec/vcr/transaction/refund/1296674173.yml +0 -287
- data/spec/vcr/transaction/void/1296674173.yml +0 -352
data/README.md
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
Recurly Ruby Client
|
2
2
|
===================
|
3
3
|
|
4
|
-
The Recurly Ruby Client library is an open source library to interact with Recurly's subscription management from your Ruby on Rails website. The library interacts with Recurly's [REST API](http://support.recurly.com/
|
4
|
+
The Recurly Ruby Client library is an open source library to interact with Recurly's subscription management from your Ruby on Rails website. The library interacts with Recurly's [REST API](http://support.recurly.com/api/basics).
|
5
5
|
|
6
6
|
|
7
7
|
Usage
|
8
8
|
-----
|
9
9
|
|
10
10
|
Please see the [documentation](http://support.recurly.com/faqs/api/ruby-client) and
|
11
|
-
[support forums](http://support.recurly.com/discussions) for more information.
|
11
|
+
[support forums](http://support.recurly.com/discussions) for more information. The [API Documentation](http://docs.recurly.com/api/basics) has numerous examples demonstrating how to use the Recurly Ruby client library.
|
12
12
|
|
13
13
|
|
14
14
|
Installation
|
15
15
|
------------
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
**Rails3 Stable Version:**
|
17
|
+
**Stable Version:**
|
20
18
|
|
21
19
|
gem 'recurly'
|
22
20
|
|
@@ -28,7 +26,7 @@ This library can be installed as a gem or a plugin. Your choice.
|
|
28
26
|
Setup (Rails 3)
|
29
27
|
--------------
|
30
28
|
|
31
|
-
The Recurly Ruby Client requires
|
29
|
+
The Recurly Ruby Client requires an API user to connect. Please see the [Authentication](http://support.recurly.com/faqs/api/authentication) documentation for more information.
|
32
30
|
|
33
31
|
If using Rails 3, the easiest way to get Recurly set up is to run `rake recurly:setup`. This will create a config/recurly.yml that has your recurly account authentication, and the Recurly rails initializer will pick it up on restart of your web app.
|
34
32
|
|
@@ -40,8 +38,10 @@ Alternatively, if not using Rails 3, just make sure to call a Recurly configure
|
|
40
38
|
|
41
39
|
Recurly.configure do |c|
|
42
40
|
c.username = 'api@yourcompany.com'
|
43
|
-
c.password = '
|
44
|
-
c.
|
41
|
+
c.password = 'your_api_key'
|
42
|
+
c.private_key = 'your_private_key'
|
43
|
+
c.environment = :production # or :sandbox for test sites
|
44
|
+
c.subdomain = 'your-recurly-subdomain'
|
45
45
|
end
|
46
46
|
|
47
47
|
In Rails 2.x, this code should be in config/initializers/recurly.rb
|
@@ -58,8 +58,10 @@ You can also configure Recurly via a YAML file by using:
|
|
58
58
|
The Recurly Configuration YAML is in the format of:
|
59
59
|
|
60
60
|
username: myrecurlyuser@domain.com
|
61
|
-
password:
|
62
|
-
|
61
|
+
password: your_api_key
|
62
|
+
private_key: your_private_key
|
63
|
+
environment: :production
|
64
|
+
subdomain: your_recurly_subdomain
|
63
65
|
|
64
66
|
|
65
67
|
The same format could be applied in JSON instead of YAML using: Recurly.configure_from_json('path/to/file.json')
|
@@ -81,6 +83,8 @@ Rails Demo Application
|
|
81
83
|
Examples
|
82
84
|
--------
|
83
85
|
|
86
|
+
The [API Documentation](http://docs.recurly.com/api/basics) has numerous examples demonstrating how to use the Ruby client library.
|
87
|
+
|
84
88
|
All the functionality is demonstrated by the tests in the __spec__ directory.
|
85
89
|
|
86
90
|
|
@@ -124,4 +128,4 @@ This will run `recurly:clear_test_data` (using your spec/config/recurly.yml auth
|
|
124
128
|
API Documentation
|
125
129
|
-----------------
|
126
130
|
|
127
|
-
Please see the [Recurly API](http://docs.recurly.com/api/basics) for more information.
|
131
|
+
Please see the [Recurly API](http://docs.recurly.com/api/basics) for more information and examples.
|
data/lib/recurly.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'active_resource'
|
2
2
|
require 'active_support/deprecation'
|
3
3
|
require 'cgi'
|
4
|
+
require 'openssl'
|
5
|
+
require 'addressable/uri'
|
6
|
+
|
7
|
+
require 'patches/active_resource/connection'
|
4
8
|
|
5
9
|
require 'recurly/version'
|
10
|
+
require 'recurly/exceptions'
|
6
11
|
require 'recurly/formats/xml_with_pagination'
|
7
12
|
require 'recurly/config_parser'
|
8
13
|
require 'recurly/rails3/railtie' if defined?(::Rails::Railtie)
|
@@ -17,6 +22,7 @@ end
|
|
17
22
|
module Recurly
|
18
23
|
|
19
24
|
autoload :Account, 'recurly/account'
|
25
|
+
autoload :AccountBase, 'recurly/account_base'
|
20
26
|
autoload :BillingInfo, 'recurly/billing_info'
|
21
27
|
autoload :Charge, 'recurly/charge'
|
22
28
|
autoload :Coupon, 'recurly/coupon'
|
@@ -25,9 +31,10 @@ module Recurly
|
|
25
31
|
autoload :Plan, 'recurly/plan'
|
26
32
|
autoload :Subscription, 'recurly/subscription'
|
27
33
|
autoload :Transaction, 'recurly/transaction'
|
34
|
+
autoload :Transparent, 'recurly/transparent'
|
28
35
|
|
29
36
|
class << self
|
30
|
-
attr_accessor :username, :password, :
|
37
|
+
attr_accessor :username, :password, :environment, :subdomain, :private_key
|
31
38
|
|
32
39
|
# default Recurly.settings_path to config/recurly.yml
|
33
40
|
unless respond_to?(:settings_path)
|
@@ -41,16 +48,16 @@ module Recurly
|
|
41
48
|
end
|
42
49
|
|
43
50
|
def configured?
|
44
|
-
|
51
|
+
Base.user && Base.password && Base.site
|
45
52
|
end
|
46
53
|
|
47
54
|
def configure
|
48
55
|
if block_given?
|
49
56
|
yield self
|
50
57
|
|
51
|
-
|
52
|
-
|
53
|
-
|
58
|
+
Base.user = username
|
59
|
+
Base.password = password
|
60
|
+
Base.site = site_for_environment(environment)
|
54
61
|
|
55
62
|
return true
|
56
63
|
else
|
@@ -61,9 +68,24 @@ module Recurly
|
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
71
|
+
|
72
|
+
def site_for_environment(environment)
|
73
|
+
environment = :production if environment.nil? # Default to production
|
74
|
+
case environment.to_sym
|
75
|
+
when :development
|
76
|
+
"http://app.recurly.local:3000"
|
77
|
+
when :production
|
78
|
+
"https://api-production.recurly.com"
|
79
|
+
when :sandbox
|
80
|
+
"https://api-sandbox.recurly.com"
|
81
|
+
else
|
82
|
+
raise Recurly::ConfigurationError.new("Invalid environment (#{environment}). Valid values are: :production, :sandbox.")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
64
86
|
|
65
87
|
# allows configuration from a yml file that contains the fields:
|
66
|
-
# username,password,site
|
88
|
+
# username,password,site,private_key
|
67
89
|
def configure_from_yaml(path = nil)
|
68
90
|
configure do |c|
|
69
91
|
# parse configuration from yml
|
@@ -78,19 +100,23 @@ module Recurly
|
|
78
100
|
|
79
101
|
c.username = recurly_config["username"]
|
80
102
|
c.password = recurly_config["password"]
|
81
|
-
c.
|
103
|
+
c.subdomain = recurly_config["subdomain"]
|
104
|
+
c.private_key = recurly_config["private_key"]
|
105
|
+
c.environment = recurly_config["environment"]
|
82
106
|
end
|
83
107
|
end
|
84
108
|
end
|
85
109
|
|
86
110
|
# allows configuration from a json string that contains the fields:
|
87
|
-
# username,password,site
|
111
|
+
# username,password,site,private_key
|
88
112
|
def configure_from_json(json_string)
|
89
113
|
config_data = ActiveSupport::JSON.decode(json_string)
|
90
114
|
configure do |c|
|
91
115
|
c.username = config_data['username']
|
92
116
|
c.password = config_data['password']
|
93
|
-
c.
|
117
|
+
c.subdomain = config_data['subdomain']
|
118
|
+
c.private_key = config_data['private_key']
|
119
|
+
c.environment = config_data['environment']
|
94
120
|
end
|
95
121
|
end
|
96
122
|
|
data/lib/recurly/account.rb
CHANGED
@@ -1,8 +1,29 @@
|
|
1
1
|
module Recurly
|
2
|
-
class Account <
|
2
|
+
class Account < Base
|
3
3
|
self.element_name = "account"
|
4
4
|
self.primary_key = :account_code
|
5
5
|
|
6
|
+
# known attributes for a recurly account
|
7
|
+
def self.known_attributes
|
8
|
+
[
|
9
|
+
"account_code",
|
10
|
+
"username",
|
11
|
+
"first_name",
|
12
|
+
"last_name",
|
13
|
+
"email",
|
14
|
+
"company_name",
|
15
|
+
"hosted_login_token",
|
16
|
+
"accept_language"
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
# initialize associations
|
21
|
+
def initialize(attributes = {})
|
22
|
+
attributes = attributes.with_indifferent_access
|
23
|
+
attributes[:billing_info] ||= {}
|
24
|
+
super(attributes)
|
25
|
+
end
|
26
|
+
|
6
27
|
attr_accessor :account_code_was
|
7
28
|
def account_code=(new_account_code)
|
8
29
|
self.account_code_was = self.account_code
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
module Recurly
|
3
|
+
# ActiveRecord treats resources as plural by default. Some resources are singular.
|
4
|
+
class AccountBase < Base
|
5
|
+
self.prefix = "/accounts/:account_code/"
|
6
|
+
|
7
|
+
# Override element_path because this is a singular resource
|
8
|
+
def self.element_path(id, prefix_options = {}, query_options = nil)
|
9
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
10
|
+
prefix_options.merge!(:account_code => id) if id
|
11
|
+
# original: "#{prefix(prefix_options)}#{collection_name}/#{URI.escape id.to_s}.#{format.extension}#{query_string(query_options)}"
|
12
|
+
"#{prefix(prefix_options)}#{element_name}.#{format.extension}#{query_string(query_options)}"
|
13
|
+
end
|
14
|
+
|
15
|
+
# element path
|
16
|
+
def element_path(options = nil)
|
17
|
+
self.class.element_path(to_param, options || prefix_options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_param
|
21
|
+
attributes[:account_code]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Override collection_path because this is a singular resource
|
25
|
+
def self.collection_path(prefix_options = {}, query_options = nil)
|
26
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
27
|
+
# original: "#{prefix(prefix_options)}#{collection_name}.#{format.extension}#{query_string(query_options)}"
|
28
|
+
"#{prefix(prefix_options)}#{element_name}.#{format.extension}#{query_string(query_options)}"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
# backwards compatibility
|
34
|
+
RecurlyAccountBase = AccountBase
|
35
|
+
end
|
data/lib/recurly/base.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
require 'active_support/memoizable'
|
2
2
|
|
3
3
|
module Recurly
|
4
|
-
|
4
|
+
|
5
|
+
class Base < ActiveResource::Base
|
5
6
|
extend ActiveSupport::Memoizable
|
6
7
|
|
7
8
|
self.format = Recurly::Formats::XmlWithPaginationFormat.new
|
8
9
|
|
10
|
+
def initialize(attributes = {})
|
11
|
+
super(attributes)
|
12
|
+
end
|
13
|
+
|
9
14
|
# Add User-Agent to headers
|
10
15
|
def headers
|
11
16
|
super
|
@@ -51,47 +56,29 @@ module Recurly
|
|
51
56
|
!persisted?
|
52
57
|
end
|
53
58
|
|
54
|
-
#
|
55
|
-
def
|
56
|
-
|
57
|
-
|
59
|
+
# builds the object from the transparent results
|
60
|
+
def from_transparent_results(response)
|
61
|
+
self.load_attributes_from_response(response)
|
62
|
+
self
|
58
63
|
end
|
59
64
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
# ActiveRecord treats resources as plural by default. Some resources are singular.
|
69
|
-
class RecurlyAccountBase < RecurlyBase
|
70
|
-
self.prefix = "/accounts/:account_code/"
|
71
|
-
|
72
|
-
# Override element_path because this is a singular resource
|
73
|
-
def self.element_path(id, prefix_options = {}, query_options = nil)
|
74
|
-
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
75
|
-
prefix_options.merge!(:account_code => id) if id
|
76
|
-
# original: "#{prefix(prefix_options)}#{collection_name}/#{URI.escape id.to_s}.#{format.extension}#{query_string(query_options)}"
|
77
|
-
"#{prefix(prefix_options)}#{element_name}.#{format.extension}#{query_string(query_options)}"
|
78
|
-
end
|
79
|
-
|
80
|
-
# element path
|
81
|
-
def element_path(options = nil)
|
82
|
-
self.class.element_path(to_param, options || prefix_options)
|
83
|
-
end
|
84
|
-
|
85
|
-
def to_param
|
86
|
-
attributes[:account_code]
|
87
|
-
end
|
65
|
+
protected
|
66
|
+
# patch load_attributes_from_response so it marks result records as persisted
|
67
|
+
def load_attributes_from_response(response)
|
68
|
+
super
|
69
|
+
@persisted = true
|
70
|
+
end
|
88
71
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
72
|
+
private
|
73
|
+
# patch instantiate_record so it marks result records as persisted
|
74
|
+
def self.instantiate_record(record, prefix_options)
|
75
|
+
result = super
|
76
|
+
result.instance_eval{ @persisted = true }
|
77
|
+
result
|
78
|
+
end
|
95
79
|
|
96
80
|
end
|
81
|
+
|
82
|
+
# backwards compatibility
|
83
|
+
RecurlyBase = Base
|
97
84
|
end
|
data/lib/recurly/billing_info.rb
CHANGED
@@ -1,7 +1,46 @@
|
|
1
1
|
module Recurly
|
2
|
-
class BillingInfo <
|
2
|
+
class BillingInfo < AccountBase
|
3
3
|
self.element_name = "billing_info"
|
4
4
|
|
5
|
+
def self.known_attributes
|
6
|
+
[
|
7
|
+
"first_name",
|
8
|
+
"last_name",
|
9
|
+
"address1",
|
10
|
+
"address2",
|
11
|
+
"city",
|
12
|
+
"state",
|
13
|
+
"zip",
|
14
|
+
"country",
|
15
|
+
"phone",
|
16
|
+
"ip_address"
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
# define attributes for inner CreditCard type
|
21
|
+
class CreditCard < Base
|
22
|
+
def self.known_attributes
|
23
|
+
[
|
24
|
+
"number",
|
25
|
+
"last_four",
|
26
|
+
"type",
|
27
|
+
"verification_value",
|
28
|
+
"month",
|
29
|
+
"year",
|
30
|
+
"start_month",
|
31
|
+
"start_year",
|
32
|
+
"issue_number"
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# initialize associations
|
38
|
+
def initialize(attributes = {})
|
39
|
+
attributes = attributes.with_indifferent_access
|
40
|
+
attributes[:credit_card] ||= {}
|
41
|
+
super(attributes)
|
42
|
+
end
|
43
|
+
|
5
44
|
def update_only
|
6
45
|
true
|
7
46
|
end
|
data/lib/recurly/charge.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
module Recurly
|
2
|
-
class Charge <
|
2
|
+
class Charge < Base
|
3
3
|
self.element_name = "charge"
|
4
4
|
self.prefix = "/accounts/:account_code/"
|
5
5
|
|
6
|
+
def self.known_attributes
|
7
|
+
[
|
8
|
+
"account_code",
|
9
|
+
"amount_in_cents",
|
10
|
+
"start_date",
|
11
|
+
"end_date",
|
12
|
+
"description",
|
13
|
+
"created_at"
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
6
17
|
def self.list(account_code, status = :all)
|
7
18
|
params = {:account_code => account_code}
|
8
19
|
|
data/lib/recurly/coupon.rb
CHANGED
data/lib/recurly/credit.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
module Recurly
|
2
|
-
class Credit <
|
2
|
+
class Credit < Base
|
3
3
|
self.element_name = "credit"
|
4
4
|
self.prefix = "/accounts/:account_code/"
|
5
5
|
|
6
|
+
def self.known_attributes
|
7
|
+
[
|
8
|
+
"account_code",
|
9
|
+
"amount_in_cents",
|
10
|
+
"start_date",
|
11
|
+
"end_date",
|
12
|
+
"description",
|
13
|
+
"created_at"
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
6
17
|
def self.list(account_code)
|
7
18
|
find(:all, :params => { :account_code => account_code })
|
8
19
|
end
|