stripe_saas 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.asc +8 -0
- data/lib/stripe_saas/configuration.rb +3 -0
- data/lib/stripe_saas/engine.rb +17 -15
- data/lib/stripe_saas/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +103 -0
- data/spec/models/plan_feature_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11d33c83f274930a298978620639a355a8c74e0f
|
4
|
+
data.tar.gz: 115508a935fc8fe389b89bb57f20adc5c412d88d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e76f158eb245eafce9c67c07eee561272b8d952d43ecce13e6d7eb0b82144cf7ee58fe8f7ce7acb79e96a548a5a4551cb9e8976b950788b7b3b631712112f4d
|
7
|
+
data.tar.gz: 3d8bff7dc13eae924e75df86389811295a0952974ae71c35fc753671d1b2d199ade53a742392ca58326e9268c65b4f3fd44ea44eec2d7ace6e126bf0487edd03
|
data/README.asc
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
A Rails 4 Engine providing Stripe subscription management for SaaS applications.
|
4
4
|
Based on the work of Andrew Culver in Koudoku (https://github.com/andrewculver/koudoku).
|
5
5
|
|
6
|
+
== Status
|
7
|
+
|
8
|
+
image:https://www.codeship.io/projects/7ab95b50-8968-0133-979d-4619ccd24e37/status?branch=master[CI Status]
|
9
|
+
image:https://codeclimate.com/github/integrallis/stripe_saas/badges/gpa.svg[
|
10
|
+
"Code Climate",link="https://codeclimate.com/github/integrallis/stripe_saas"]
|
11
|
+
image:https://codeclimate.com/github/integrallis/stripe_saas/badges/coverage.svg[
|
12
|
+
"Test Coverage",link="https://codeclimate.com/github/integrallis/stripe_saas/coverage"]
|
13
|
+
|
6
14
|
== Installation
|
7
15
|
|
8
16
|
=== Add gem dependency
|
data/lib/stripe_saas/engine.rb
CHANGED
@@ -18,21 +18,23 @@ module StripeSaas
|
|
18
18
|
if StripeSaas.create_plans_in_stripe?
|
19
19
|
begin
|
20
20
|
::Plan.all.each do |plan|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
21
|
+
unless StripeSaas.non_stripe_plans.include?(plan.stripe_id)
|
22
|
+
begin
|
23
|
+
stripe_plan = Stripe::Plan.retrieve(plan.stripe_id)
|
24
|
+
rescue Stripe::InvalidRequestError => ire
|
25
|
+
if ire.message == "No such plan: #{plan.stripe_id}"
|
26
|
+
Stripe::Plan.create(
|
27
|
+
id: plan.stripe_id,
|
28
|
+
name: plan.name,
|
29
|
+
amount: plan.price_cents,
|
30
|
+
interval: plan.interval,
|
31
|
+
interval_count: plan.interval_count,
|
32
|
+
trial_period_days: plan.trial_period_days,
|
33
|
+
statement_descriptor: plan.statement_descriptor,
|
34
|
+
currency: 'usd',
|
35
|
+
metadata: plan.metadata_as_json
|
36
|
+
)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
data/lib/stripe_saas/version.rb
CHANGED
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/dummy/log/test.log
CHANGED
@@ -3323,3 +3323,106 @@ Migrating to CreatePlanFeatures (20151220161817)
|
|
3323
3323
|
[1m[35m (2.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3324
3324
|
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3325
3325
|
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3326
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3327
|
+
[1m[36m (2.2ms)[0m [1mCREATE TABLE "features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "description" varchar, "feature_type" varchar, "unit" varchar, "display_order" integer, "use_unit" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3328
|
+
[1m[35m (1.8ms)[0m CREATE TABLE "plan_features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" varchar, "display_value" varchar, "plan_id" integer, "feature_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3329
|
+
[1m[36m (1.7ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "statement_descriptor" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3330
|
+
[1m[35m (1.3ms)[0m CREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3331
|
+
[1m[36m (1.8ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
3332
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3333
|
+
[1m[36m (1.8ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3334
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
3335
|
+
FROM sqlite_master
|
3336
|
+
WHERE name='index_users_on_email' AND type='index'
|
3337
|
+
UNION ALL
|
3338
|
+
SELECT sql
|
3339
|
+
FROM sqlite_temp_master
|
3340
|
+
WHERE name='index_users_on_email' AND type='index'
|
3341
|
+
|
3342
|
+
[1m[36m (1.2ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3343
|
+
[1m[35m (1.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3344
|
+
[1m[36m (1.7ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3345
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
3346
|
+
[1m[36m (1.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3347
|
+
[1m[35m (1.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3348
|
+
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3349
|
+
[1m[35m (0.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3350
|
+
[1m[36m (0.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3351
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3352
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "description" varchar, "feature_type" varchar, "unit" varchar, "display_order" integer, "use_unit" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3353
|
+
[1m[35m (3.1ms)[0m CREATE TABLE "plan_features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" varchar, "display_value" varchar, "plan_id" integer, "feature_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3354
|
+
[1m[36m (1.9ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "statement_descriptor" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3355
|
+
[1m[35m (2.0ms)[0m CREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3356
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
3357
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3358
|
+
[1m[36m (1.9ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3359
|
+
[1m[35m (0.2ms)[0m SELECT sql
|
3360
|
+
FROM sqlite_master
|
3361
|
+
WHERE name='index_users_on_email' AND type='index'
|
3362
|
+
UNION ALL
|
3363
|
+
SELECT sql
|
3364
|
+
FROM sqlite_temp_master
|
3365
|
+
WHERE name='index_users_on_email' AND type='index'
|
3366
|
+
|
3367
|
+
[1m[36m (1.7ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3368
|
+
[1m[35m (1.7ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3369
|
+
[1m[36m (1.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3370
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
3371
|
+
[1m[36m (2.3ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3372
|
+
[1m[35m (3.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3373
|
+
[1m[36m (1.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3374
|
+
[1m[35m (1.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3375
|
+
[1m[36m (1.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3376
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3377
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3378
|
+
[1m[36m (1.9ms)[0m [1mCREATE TABLE "features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "description" varchar, "feature_type" varchar, "unit" varchar, "display_order" integer, "use_unit" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3379
|
+
[1m[35m (1.9ms)[0m CREATE TABLE "plan_features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" varchar, "display_value" varchar, "plan_id" integer, "feature_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3380
|
+
[1m[36m (1.7ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "statement_descriptor" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3381
|
+
[1m[35m (2.1ms)[0m CREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3382
|
+
[1m[36m (2.8ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
3383
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
3384
|
+
[1m[36m (2.0ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3385
|
+
[1m[35m (0.2ms)[0m SELECT sql
|
3386
|
+
FROM sqlite_master
|
3387
|
+
WHERE name='index_users_on_email' AND type='index'
|
3388
|
+
UNION ALL
|
3389
|
+
SELECT sql
|
3390
|
+
FROM sqlite_temp_master
|
3391
|
+
WHERE name='index_users_on_email' AND type='index'
|
3392
|
+
|
3393
|
+
[1m[36m (3.0ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3394
|
+
[1m[35m (1.8ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3395
|
+
[1m[36m (1.7ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3396
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
3397
|
+
[1m[36m (1.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3398
|
+
[1m[35m (3.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3399
|
+
[1m[36m (2.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3400
|
+
[1m[35m (1.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3401
|
+
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3402
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.6ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3403
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3404
|
+
[1m[36m (4.6ms)[0m [1mCREATE TABLE "features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "description" varchar, "feature_type" varchar, "unit" varchar, "display_order" integer, "use_unit" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3405
|
+
[1m[35m (3.0ms)[0m CREATE TABLE "plan_features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" varchar, "display_value" varchar, "plan_id" integer, "feature_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3406
|
+
[1m[36m (7.9ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "statement_descriptor" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
3407
|
+
[1m[35m (17.9ms)[0m CREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
3408
|
+
[1m[36m (5.3ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
3409
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3410
|
+
[1m[36m (4.0ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3411
|
+
[1m[35m (0.2ms)[0m SELECT sql
|
3412
|
+
FROM sqlite_master
|
3413
|
+
WHERE name='index_users_on_email' AND type='index'
|
3414
|
+
UNION ALL
|
3415
|
+
SELECT sql
|
3416
|
+
FROM sqlite_temp_master
|
3417
|
+
WHERE name='index_users_on_email' AND type='index'
|
3418
|
+
|
3419
|
+
[1m[36m (3.1ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3420
|
+
[1m[35m (7.8ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3421
|
+
[1m[36m (4.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3422
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
3423
|
+
[1m[36m (7.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3424
|
+
[1m[35m (17.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3425
|
+
[1m[36m (1.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3426
|
+
[1m[35m (2.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3427
|
+
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3428
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe_saas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Sam-Bodden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|