stripe-rails 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +9 -0
- data/Changelog.md +4 -1
- data/Gemfile +5 -0
- data/LICENSE +1 -1
- data/README.md +170 -94
- data/config/routes.rb +3 -1
- data/lib/generators/templates/plans.rb +2 -2
- data/lib/stripe/callbacks.rb +7 -1
- data/lib/stripe/configuration_builder.rb +3 -1
- data/lib/stripe/engine.rb +2 -1
- data/lib/stripe/plans.rb +2 -2
- data/lib/stripe/rails/version.rb +1 -1
- data/stripe-rails.gemspec +0 -4
- data/test/dummy/config/environments/test.rb +3 -3
- data/test/dummy/config/initializers/secret_token.rb +1 -0
- data/test/plan_builder_spec.rb +40 -0
- metadata +70 -112
- checksums.yaml +0 -7
data/.travis.yml
ADDED
data/Changelog.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
## 0.2.6 (2013-10-17)
|
2
|
+
* add `auto_mount` option to allow for manually mounting the webhook endpoints
|
3
|
+
|
1
4
|
## 0.2.5 (2013-03-18)
|
2
5
|
* make the default max redemptions 1
|
3
6
|
* add stripe::coupons::reset! task to redefine all coupons
|
4
7
|
|
5
|
-
## 0.2.2 (
|
8
|
+
## 0.2.2 (2013-01-09)
|
6
9
|
* bugfix allowing creation of coupons without max_redemptions
|
7
10
|
|
8
11
|
## 0.2.1 (2012-12-17)
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# Stripe::Rails: A Rails Engine for use with [stripe.com](https://stripe.com)
|
2
|
+
[](http://badge.fury.io/rb/stripe-rails)
|
3
|
+
[](https://travis-ci.org/thefrontside/stripe-rails)
|
4
|
+
[](https://gemnasium.com/thefrontside/stripe-rails)
|
5
|
+
|
2
6
|
|
3
7
|
This gem can help your rails application integrate with Stripe in the following ways
|
4
8
|
|
@@ -11,50 +15,79 @@ This gem can help your rails application integrate with Stripe in the following
|
|
11
15
|
|
12
16
|
Add this line to your application's Gemfile:
|
13
17
|
|
14
|
-
|
18
|
+
```ruby
|
19
|
+
gem 'stripe-rails'
|
20
|
+
```
|
15
21
|
|
16
22
|
If you are going to be using [stripe.js][1] to securely collect credit card information
|
17
23
|
on the client, then you will need to add the stripe javascript tags into your template.
|
18
24
|
stripe-rails provides a helper to make this easy:
|
19
25
|
|
20
|
-
|
21
|
-
|
26
|
+
```erb
|
27
|
+
<%= stripe_javascript_tag %>
|
28
|
+
```
|
22
29
|
or, you can render it as a partial:
|
23
30
|
|
24
|
-
|
25
|
-
|
31
|
+
```erb
|
32
|
+
<%= render :partial => 'stripe/js' %>
|
33
|
+
```
|
26
34
|
In both cases, stripe-rails will choose a version of stripe.js appropriate for your
|
27
35
|
development environment and automatically configure it to use
|
28
36
|
your publishable API key. By default it uses `stripe-debug.js` for your `development`
|
29
37
|
environment and `stripe.js` for everything else, but you can manually configure it
|
30
38
|
per environment
|
31
39
|
|
32
|
-
|
33
|
-
|
40
|
+
```ruby
|
41
|
+
config.stripe.debug_js = true # use stripe-debug.js
|
42
|
+
config.stripe.debug_js = false # use stripe.js
|
43
|
+
```
|
34
44
|
|
35
45
|
### Setup your API keys.
|
36
46
|
|
37
47
|
You will need to configure your application to authenticate with stripe.com
|
38
48
|
using [your api key][1]. There are two methods to do this, you can either set the environment
|
39
|
-
variable `STRIPE_API_KEY
|
49
|
+
variable `STRIPE_API_KEY`:
|
50
|
+
|
51
|
+
```sh
|
52
|
+
export STRIPE_API_KEY=sk_test_xxyyzz
|
53
|
+
```
|
54
|
+
|
55
|
+
or if you are on heroku:
|
56
|
+
|
57
|
+
```sh
|
58
|
+
heroku config:add STRIPE_API_KEY=sk_test_xxyyzz
|
59
|
+
```
|
60
|
+
|
61
|
+
You can also set this value from inside ruby configuration code:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
config.stripe.api_key = "sk_test_xxyyzz"
|
65
|
+
```
|
66
|
+
|
40
67
|
In either case, it is recommended that you *not* check in this value into source control.
|
41
68
|
|
42
69
|
You can verify that your api is set up and functioning properly by running the following command:
|
43
70
|
|
44
|
-
|
71
|
+
```sh
|
72
|
+
rake stripe:verify
|
73
|
+
```
|
45
74
|
|
46
75
|
If you are going to be using stripe.js, then you will also need to set the value of your
|
47
76
|
publishiable key. A nice way to do it is to set your test publishable for all environments:
|
48
77
|
|
49
|
-
|
50
|
-
|
51
|
-
|
78
|
+
```ruby
|
79
|
+
# config/application.rb
|
80
|
+
# ...
|
81
|
+
config.stripe.publishable_key = 'pk_test_XXXYYYZZZ'
|
82
|
+
```
|
52
83
|
|
53
84
|
And then override it to use your live key in production only
|
54
85
|
|
55
|
-
|
56
|
-
|
57
|
-
|
86
|
+
```ruby
|
87
|
+
# config/environments/production.rb
|
88
|
+
# ...
|
89
|
+
config.stripe.publishable_key = 'pk_live_XXXYYYZZZ'
|
90
|
+
```
|
58
91
|
|
59
92
|
This key will be publicly visible on the internet, so it is ok to put in your source.
|
60
93
|
|
@@ -64,47 +97,58 @@ If you're using subscriptions, then you'll need to set up your application's pay
|
|
64
97
|
and discounts. `Stripe::Rails` lets you automate the management of these definitions from
|
65
98
|
within the application itself. To get started:
|
66
99
|
|
67
|
-
|
100
|
+
```sh
|
101
|
+
rails generate stripe:install
|
102
|
+
```
|
68
103
|
|
69
104
|
this will generate the configuration files containing your plan and coupon definitions:
|
70
105
|
|
71
|
-
|
72
|
-
|
106
|
+
```console
|
107
|
+
create config/stripe/plans.rb
|
108
|
+
create config/stripe/coupons.rb
|
109
|
+
```
|
73
110
|
|
74
111
|
### Configuring your plans and coupons
|
75
112
|
|
76
113
|
Use the plan builder to define as many plans as you want in `config/stripe/plans.rb`
|
77
114
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
115
|
+
```ruby
|
116
|
+
Stripe.plan :silver do |plan|
|
117
|
+
plan.name = 'ACME Silver'
|
118
|
+
plan.amount = 699 # $6.99
|
119
|
+
plan.interval = 'month'
|
120
|
+
end
|
83
121
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
122
|
+
Stripe.plan :gold do |plan|
|
123
|
+
plan.name = 'ACME Gold'
|
124
|
+
plan.amount = 999 # $9.99
|
125
|
+
plan.interval = 'month'
|
126
|
+
end
|
127
|
+
```
|
89
128
|
|
90
129
|
This will define constants for these plans in the Stripe::Plans module so that you
|
91
130
|
can refer to them by reference as opposed to an id string.
|
92
131
|
|
93
|
-
|
94
|
-
|
95
|
-
|
132
|
+
```ruby
|
133
|
+
Stripe::Plans::SILVER # => 'silver: ACME Silver'
|
134
|
+
Stripe::Plans::GOLD # => 'gold: ACME Gold'
|
135
|
+
```
|
96
136
|
|
97
137
|
Coupons are created in much the same way:
|
98
138
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
139
|
+
```ruby
|
140
|
+
Stripe.coupon :super_elite_free_vip do |coupon|
|
141
|
+
coupon.duration = 'forever'
|
142
|
+
coupon.percent_off = 100
|
143
|
+
coupon.max_redemptions = 5
|
144
|
+
end
|
145
|
+
```
|
104
146
|
|
105
147
|
To upload your plans and coupons onto stripe.com, run:
|
106
148
|
|
107
|
-
|
149
|
+
```sh
|
150
|
+
rake stripe:prepare
|
151
|
+
```
|
108
152
|
|
109
153
|
This will create any plans and coupons that do not currently exist, and treat as a NOOP any
|
110
154
|
plans that do, so you can run this command safely as many times as you wish. Now you can
|
@@ -123,9 +167,31 @@ and `http://mystagingapp.com/stripe/events` for your test mode.
|
|
123
167
|
If you want to mount the stripe engine somewhere else, you can do so by setting the `stripe.endpoint`
|
124
168
|
parameter. E.g.
|
125
169
|
|
126
|
-
|
170
|
+
```ruby
|
171
|
+
config.stripe.endpoint = '/payment/stripe-integration'
|
172
|
+
```
|
173
|
+
|
174
|
+
Your new webook URL would then be `http://myproductionapp/payment/stripe-integration/events`
|
127
175
|
|
128
|
-
|
176
|
+
### Disabling auto mount
|
177
|
+
|
178
|
+
Sometimes, you don't want the stripe engine to be auto-mounted so that
|
179
|
+
you control *exactly* what priority it will take in your routing
|
180
|
+
table. This is especially important if you have a catch-all route
|
181
|
+
which should appear after all other routes. In order to disable
|
182
|
+
auto-mounting of the Stripe engine:
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
# in application.rb
|
186
|
+
config.stripe.auto_mount = false
|
187
|
+
```
|
188
|
+
|
189
|
+
Then, you will have to manually mount the engine in your main application.
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
# in your application's routes.rb:
|
193
|
+
mount Stripe::Engine => "/stripe"
|
194
|
+
```
|
129
195
|
|
130
196
|
### Responding to webhooks
|
131
197
|
|
@@ -133,34 +199,38 @@ Once you have your webhook URL configured you can respond to a stripe webhook *a
|
|
133
199
|
application just by including the Stripe::Callbacks module into your class and declaring a
|
134
200
|
callback with one of the callback methods. For example, to update a customer's payment status:
|
135
201
|
|
136
|
-
|
137
|
-
|
202
|
+
```ruby
|
203
|
+
class User < ActiveRecord::Base
|
204
|
+
include Stripe::Callbacks
|
138
205
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
145
|
-
end
|
206
|
+
after_customer_updated! do |customer, event|
|
207
|
+
user = User.find_by_stripe_customer_id(customer.id)
|
208
|
+
if customer.delinquent
|
209
|
+
user.is_account_current = false
|
210
|
+
user.save!
|
146
211
|
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
```
|
147
215
|
|
148
216
|
or to send an email with one of your customer's monthly invoices
|
149
217
|
|
150
|
-
|
151
|
-
|
218
|
+
```ruby
|
219
|
+
class InvoiceMailer < ActionMailer::Base
|
220
|
+
include Stripe::Callbacks
|
152
221
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
222
|
+
after_invoice_created! do |invoice, event|
|
223
|
+
user = User.find_by_stripe_customer(invoice.customer)
|
224
|
+
new_invoice(user, invoice).deliver
|
225
|
+
end
|
157
226
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
227
|
+
def new_invoice(user, invoice)
|
228
|
+
@user = user
|
229
|
+
@invoice = invoice
|
230
|
+
mail :to => user.email, :subject => '[Acme.com] Your new invoice'
|
231
|
+
end
|
232
|
+
end
|
233
|
+
```
|
164
234
|
|
165
235
|
The naming convention for the callback events is after__{callback_name}! where `callback_name`
|
166
236
|
is name of the stripe event with all `.` characters substituted with underscores. So, for
|
@@ -184,13 +254,15 @@ receives a successful response. On the other hand, there are some tasks that are
|
|
184
254
|
such a big deal if they get dropped on the floor. For example, A non-critical hook can be used to do things like have a bot
|
185
255
|
notify your company's chatroom that something a credit card was successfully charged:
|
186
256
|
|
187
|
-
|
188
|
-
|
257
|
+
```ruby
|
258
|
+
class AcmeBot
|
259
|
+
include Stripe::Callbacks
|
189
260
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
261
|
+
after_charge_succeeded do |charge|
|
262
|
+
announce "Attention all Dudes and Dudettes. Ya'll are so PAID!!!"
|
263
|
+
end
|
264
|
+
end
|
265
|
+
```
|
194
266
|
|
195
267
|
Chances are that if you experience a momentary failure in connectivity to your chatroom, you don't want the whole payment notification to fail.
|
196
268
|
|
@@ -201,51 +273,55 @@ Certain stripe events represent updates to existing data. You may want to only f
|
|
201
273
|
are updated. You can pass an `:only` option to your callback to filter to specify which attribute updates you're interested in. For
|
202
274
|
example, to warn users whenever their credit card has changed:
|
203
275
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
after_customer_updated! :only => :active_card do |customer, evt|
|
208
|
-
your_credit_card_on_file_was_updated_are_you_sure_this_was_you(customer).deliver
|
209
|
-
end
|
210
|
-
end
|
276
|
+
```ruby
|
277
|
+
class StripeMailer
|
278
|
+
include Stripe::Callbacks
|
211
279
|
|
280
|
+
after_customer_updated! :only => :active_card do |customer, evt|
|
281
|
+
your_credit_card_on_file_was_updated_are_you_sure_this_was_you(customer).deliver
|
282
|
+
end
|
283
|
+
end
|
284
|
+
```
|
212
285
|
|
213
286
|
Filters can be specified as an array as well:
|
214
287
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
after_invoice_updated! :only => [:amount, :subtotal] do
|
219
|
-
# update our records
|
220
|
-
end
|
221
|
-
end
|
288
|
+
```ruby
|
289
|
+
module Accounting
|
290
|
+
include Stripe::Callbacks
|
222
291
|
|
292
|
+
after_invoice_updated! :only => [:amount, :subtotal] do
|
293
|
+
# update our records
|
294
|
+
end
|
295
|
+
end
|
296
|
+
```
|
223
297
|
|
224
298
|
Alternatively, you can just pass a proc to filter the event manually. It will receive an instance of [`Stripe::Event`][4] as
|
225
299
|
its parameter:
|
226
300
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
after_charge_created! :only => proc {|charge, evt| unless evt.livemode} do |charge|
|
231
|
-
puts "FAKE DATA, PLEASE IGNORE!"
|
232
|
-
end
|
233
|
-
end
|
301
|
+
```ruby
|
302
|
+
module StagingOnly
|
303
|
+
include Stripe::Callbacks
|
234
304
|
|
305
|
+
after_charge_created! :only => proc {|charge, evt| unless evt.livemode} do |charge|
|
306
|
+
puts "FAKE DATA, PLEASE IGNORE!"
|
307
|
+
end
|
308
|
+
end
|
309
|
+
```
|
235
310
|
|
236
311
|
### Catchall Callback
|
237
312
|
|
238
313
|
The special 'stripe.event' callback will be invoked for every single event received from stripe.com. This can be useful for things
|
239
314
|
like logging and analytics:
|
240
315
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
after_stripe_event do |target, event|
|
245
|
-
# do something useful
|
246
|
-
end
|
247
|
-
end
|
316
|
+
```ruby
|
317
|
+
class StripeFirehose
|
318
|
+
include Stripe::Callbacks
|
248
319
|
|
320
|
+
after_stripe_event do |target, event|
|
321
|
+
# do something useful
|
322
|
+
end
|
323
|
+
end
|
324
|
+
```
|
249
325
|
|
250
326
|
See the [complete listing of all stripe events][5], and the [webhook tutorial][6] for more great information on this subject.
|
251
327
|
|
data/config/routes.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# # amount in cents. This is 6.99
|
12
12
|
# plan.amount = 699
|
13
13
|
#
|
14
|
-
# # interval must be either 'month' or 'year'
|
14
|
+
# # interval must be either 'week', 'month' or 'year'
|
15
15
|
# plan.interval = 'month'
|
16
16
|
#
|
17
17
|
# # only bill once every three months (default 1)
|
@@ -26,4 +26,4 @@
|
|
26
26
|
# rake stripe:prepare
|
27
27
|
#
|
28
28
|
# This will export any new plans to stripe.com so that you can
|
29
|
-
# begin using them in your API calls.
|
29
|
+
# begin using them in your API calls.
|
data/lib/stripe/callbacks.rb
CHANGED
@@ -6,15 +6,20 @@ module Stripe
|
|
6
6
|
|
7
7
|
callback 'account.updated'
|
8
8
|
callback 'account.application.deauthorized'
|
9
|
+
callback 'balance.available'
|
9
10
|
callback 'charge.succeeded'
|
10
11
|
callback 'charge.failed'
|
11
12
|
callback 'charge.refunded'
|
13
|
+
callback 'charge.captured'
|
12
14
|
callback 'charge.dispute.created'
|
13
15
|
callback 'charge.dispute.updated'
|
14
16
|
callback 'charge.dispute.closed'
|
15
17
|
callback 'customer.created'
|
16
18
|
callback 'customer.updated'
|
17
19
|
callback 'customer.deleted'
|
20
|
+
callback 'customer.card.created'
|
21
|
+
callback 'customer.card.updated'
|
22
|
+
callback 'customer.card.deleted'
|
18
23
|
callback 'customer.subscription.created'
|
19
24
|
callback 'customer.subscription.updated'
|
20
25
|
callback 'customer.subscription.deleted'
|
@@ -37,6 +42,7 @@ module Stripe
|
|
37
42
|
callback 'coupon.deleted'
|
38
43
|
callback 'transfer.created'
|
39
44
|
callback 'transfer.updated'
|
45
|
+
callback 'transfer.paid'
|
40
46
|
callback 'transfer.failed'
|
41
47
|
callback 'ping'
|
42
48
|
callback 'stripe.event'
|
@@ -70,4 +76,4 @@ module Stripe
|
|
70
76
|
end
|
71
77
|
end
|
72
78
|
end
|
73
|
-
end
|
79
|
+
end
|
data/lib/stripe/engine.rb
CHANGED
@@ -8,12 +8,13 @@ module Stripe
|
|
8
8
|
attr_accessor :testing
|
9
9
|
end
|
10
10
|
|
11
|
-
config.stripe = Struct.new(:api_base, :api_key, :verify_ssl_certs, :publishable_key, :endpoint, :debug_js).new
|
11
|
+
config.stripe = Struct.new(:api_base, :api_key, :verify_ssl_certs, :publishable_key, :endpoint, :debug_js, :auto_mount).new
|
12
12
|
|
13
13
|
initializer 'stripe.configure.defaults', :before => 'stripe.configure' do |app|
|
14
14
|
stripe = app.config.stripe
|
15
15
|
stripe.api_key ||= ENV['STRIPE_API_KEY']
|
16
16
|
stripe.endpoint ||= '/stripe'
|
17
|
+
stripe.auto_mount = true if stripe.auto_mount.nil?
|
17
18
|
if stripe.debug_js.nil?
|
18
19
|
stripe.debug_js = ::Rails.env.development?
|
19
20
|
end
|
data/lib/stripe/plans.rb
CHANGED
@@ -7,7 +7,7 @@ module Stripe
|
|
7
7
|
attr_accessor :name, :amount, :interval, :interval_count, :trial_period_days
|
8
8
|
|
9
9
|
validates_presence_of :id, :name, :amount
|
10
|
-
validates_inclusion_of :interval, :in => %w(month year), :message => "'%{value}' is not one of 'month' or 'year'"
|
10
|
+
validates_inclusion_of :interval, :in => %w(week month year), :message => "'%{value}' is not one of 'week', 'month' or 'year'"
|
11
11
|
|
12
12
|
def initialize(*args)
|
13
13
|
super(*args)
|
@@ -28,4 +28,4 @@ module Stripe
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
-
end
|
31
|
+
end
|
data/lib/stripe/rails/version.rb
CHANGED
data/stripe-rails.gemspec
CHANGED
@@ -16,8 +16,4 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Stripe::Rails::VERSION
|
17
17
|
gem.add_dependency 'rails', '>= 3'
|
18
18
|
gem.add_dependency 'stripe'
|
19
|
-
|
20
|
-
gem.add_development_dependency 'tzinfo'
|
21
|
-
gem.add_development_dependency 'mocha'
|
22
|
-
gem.add_development_dependency 'rack-test'
|
23
19
|
end
|
@@ -15,9 +15,6 @@ Dummy::Application.configure do
|
|
15
15
|
config.serve_static_assets = true
|
16
16
|
config.static_cache_control = "public, max-age=3600"
|
17
17
|
|
18
|
-
# Log error messages when you accidentally call methods on nil
|
19
|
-
config.whiny_nils = true
|
20
|
-
|
21
18
|
# Show full error reports and disable caching
|
22
19
|
config.consider_all_requests_local = true
|
23
20
|
config.action_controller.perform_caching = false
|
@@ -38,4 +35,7 @@ Dummy::Application.configure do
|
|
38
35
|
|
39
36
|
# Print deprecation notices to the stderr
|
40
37
|
config.active_support.deprecation = :stderr
|
38
|
+
|
39
|
+
# Set eager_load to false as it's unneeded
|
40
|
+
config.eager_load = false
|
41
41
|
end
|
@@ -5,3 +5,4 @@
|
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
7
|
Dummy::Application.config.secret_token = '5e507bc08a89b8b07e1ce08c932ec89771be6500e4d2d64c38164d2405d27578c33edc2982dd9ee67d4c49e0dd75992ac2ed6eb120bea0e16516549466906d06'
|
8
|
+
Dummy::Application.config.secret_key_base = 'a87ae91f28326ebe41f7ce9b7b799bb9'
|
data/test/plan_builder_spec.rb
CHANGED
@@ -29,6 +29,46 @@ describe 'building plans' do
|
|
29
29
|
Stripe::Plans['primo'].must_equal Stripe::Plans::PRIMO
|
30
30
|
end
|
31
31
|
|
32
|
+
it 'accepts a billing interval of a week' do
|
33
|
+
Stripe.plan :weekly do |plan|
|
34
|
+
plan.name = 'Acme as a service weekly'
|
35
|
+
plan.amount = 100
|
36
|
+
plan.interval = 'week'
|
37
|
+
end
|
38
|
+
|
39
|
+
Stripe::Plans::WEEKLY.wont_be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'accepts a billing interval of a month' do
|
43
|
+
Stripe.plan :monthly do |plan|
|
44
|
+
plan.name = 'Acme as a service monthly'
|
45
|
+
plan.amount = 400
|
46
|
+
plan.interval = 'month'
|
47
|
+
end
|
48
|
+
|
49
|
+
Stripe::Plans::MONTHLY.wont_be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'accepts a billing interval of a year' do
|
53
|
+
Stripe.plan :yearly do |plan|
|
54
|
+
plan.name = 'Acme as a service yearly'
|
55
|
+
plan.amount = 4800
|
56
|
+
plan.interval = 'year'
|
57
|
+
end
|
58
|
+
|
59
|
+
Stripe::Plans::YEARLY.wont_be_nil
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'denies arbitrary billing intervals' do
|
63
|
+
lambda {
|
64
|
+
Stripe.plan :broken do |plan|
|
65
|
+
plan.name = 'Acme as a service BROKEN'
|
66
|
+
plan.amount = 999
|
67
|
+
plan.interval = 'anything'
|
68
|
+
end
|
69
|
+
}.must_raise Stripe::InvalidConfigurationError
|
70
|
+
end
|
71
|
+
|
32
72
|
describe 'uploading' do
|
33
73
|
describe 'when none exists on stripe.com' do
|
34
74
|
before do
|
metadata
CHANGED
@@ -1,114 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
12
|
+
authors:
|
7
13
|
- rubygeek
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
GRYDbmV0MB4XDTEzMDEzMDIxMDYwNFoXDTE0MDEzMDIxMDYwNFowRTEQMA4GA1UE
|
16
|
-
AwwHY293Ym95ZDEcMBoGCgmSJomT8ixkARkWDHRoZWZyb250c2lkZTETMBEGCgmS
|
17
|
-
JomT8ixkARkWA25ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO45
|
18
|
-
CUxpETDGYXjCCy2dMg/aIrdrTqBqQW5ZrzhHxF9EkcdmWFr0z/qMz0JSpZ3pF11Z
|
19
|
-
KYaj5PaQQpjZfLPwbuiGGkuSWi+UAac//V18xo6S4lzRBjO+gpzG9f2AOzt9b+SR
|
20
|
-
Uc8UhO7QBZ5edUDxMxw9QstD+U0YBAlzsPJbHuUOqdtxXmNQCds3ZnqTgZaIpdUy
|
21
|
-
CSejtrukSmlthxFzwgMezYQhcYxmkl+Q475JUodnI6Pjc6nja/Or8Y6cEWiLgeUa
|
22
|
-
a+efcPGLDEbwJC7TGRrvk8yassMByBEJ3XueTMzeqWFd+665ptciojYo6BvIAR0N
|
23
|
-
iLwks0x567FZyS8SqTcCAwEAAaM5MDcwCQYDVR0TBAIwADAdBgNVHQ4EFgQUxVgR
|
24
|
-
5TUqf7Hd24ICb3g4FNbM7oYwCwYDVR0PBAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IB
|
25
|
-
AQDdJj+NzZhiYXA56z0wzRUA/Fcf6CYqKB+RFRlPssDEcHTor5SnwdWgQof/gNLi
|
26
|
-
Qel1Om4zO0Shcp89jxaUqtvEdYVhmyfc0vycHmemKttNBT734yMrEJtF8Hhy+Dnz
|
27
|
-
9CzixXLvgGaRH+mf3M0+l+zIDJJr2L+39L8cyTSSRnp/srfI8aSmJKhGshudBKoC
|
28
|
-
Ty6Gi071pwoJXvdMaE/6iPy7bUzlndYdHyYuWSKaO9N47HqQ62oEnBraglw6ghoi
|
29
|
-
UgImJlChAzCoDP9zi9tdm6jAr7ttF25R9PPYr11ILb7dYe3qUzlNlM6zJx/nb31b
|
30
|
-
IhdyRVup4qLcqYSTPsm6u7VA
|
31
|
-
-----END CERTIFICATE-----
|
32
|
-
date: 2013-03-18 00:00:00.000000000 Z
|
33
|
-
dependencies:
|
34
|
-
- !ruby/object:Gem::Dependency
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2013-10-17 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
35
21
|
name: rails
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3'
|
41
|
-
type: :runtime
|
42
22
|
prerelease: false
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 5
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
version: "3"
|
55
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: stripe
|
56
36
|
prerelease: false
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
version: '0'
|
69
|
-
type: :development
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: mocha
|
78
|
-
requirement: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '>='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: rack-test
|
92
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '>='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
type: :development
|
98
|
-
prerelease: false
|
99
|
-
version_requirements: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '>='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
104
48
|
description: A gem to integrate stripe into your rails app
|
105
|
-
email:
|
49
|
+
email:
|
106
50
|
- nola@rubygeek.com
|
107
51
|
executables: []
|
52
|
+
|
108
53
|
extensions: []
|
54
|
+
|
109
55
|
extra_rdoc_files: []
|
110
|
-
|
56
|
+
|
57
|
+
files:
|
111
58
|
- .gitignore
|
59
|
+
- .travis.yml
|
112
60
|
- Changelog.md
|
113
61
|
- Gemfile
|
114
62
|
- LICENSE
|
@@ -177,30 +125,40 @@ files:
|
|
177
125
|
- test/plan_builder_spec.rb
|
178
126
|
- test/spec_helper.rb
|
179
127
|
- test/stripe_rails_spec.rb
|
180
|
-
homepage:
|
128
|
+
homepage: ""
|
181
129
|
licenses: []
|
182
|
-
|
130
|
+
|
183
131
|
post_install_message:
|
184
132
|
rdoc_options: []
|
185
|
-
|
133
|
+
|
134
|
+
require_paths:
|
186
135
|
- lib
|
187
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
197
154
|
requirements: []
|
155
|
+
|
198
156
|
rubyforge_project:
|
199
|
-
rubygems_version:
|
157
|
+
rubygems_version: 1.8.24
|
200
158
|
signing_key:
|
201
|
-
specification_version:
|
159
|
+
specification_version: 3
|
202
160
|
summary: A gem to integrate stripe into your rails app
|
203
|
-
test_files:
|
161
|
+
test_files:
|
204
162
|
- test/.DS_Store
|
205
163
|
- test/all.rb
|
206
164
|
- test/callbacks_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 659c7c36f43dc5ea3c5596a4a0b52d627c2d7246
|
4
|
-
data.tar.gz: 880df11f0ddffa5384c0be43f85b25e78d03a4c7
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 45449d368835770b267dd7f72e483ffbbd0c00c7c15ae016d82593c28e6899d71509a9876a48d57024a4fab4f749fd857203e62f1e84ecae85a213980c2d8217
|
7
|
-
data.tar.gz: 4f7cc37aaac434771fa96506b9f86055499bfbcee24db0ad5d5a8caa33784848d681cf2533a26cd8944bb0420975713d3bbe64b9973b9eaa057124cf681af621
|