stripe_saas 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e683d926b99d47e967cde412ccf290153f5cac08
|
4
|
+
data.tar.gz: 9caf9845349a7b64dcb429c86676853cf53447fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcfed1599303739ebb5e09a1e2641abe568a7d5eeb1979d401d975c306d9ea90fa18794478280d81c518c59c2038463a285c4287f31b8ffa236b5776f9d9a284
|
7
|
+
data.tar.gz: 26811659cdf3b5d511680f963e70485a32b9eee4f4e0b2fd0d90b1e3b0e0c4b8014108244b797112bf9a0f742c452f9d2aaa9789764f28232c2f848313981c6d
|
@@ -6,7 +6,7 @@ module StripeSaas::Plan
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def is_upgrade_from?(plan)
|
9
|
-
(
|
9
|
+
(price_cents || 0) >= (plan.price_cents || 0)
|
10
10
|
end
|
11
11
|
|
12
12
|
def is_downgrade_from?(plan)
|
@@ -14,7 +14,7 @@ module StripeSaas::Plan
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def free?
|
17
|
-
|
17
|
+
price_cents.zero?
|
18
18
|
end
|
19
19
|
|
20
20
|
def add_feature(feature, value, display_value=nil)
|
@@ -2,8 +2,12 @@ class Plan < ActiveRecord::Base
|
|
2
2
|
has_many :subscriptions
|
3
3
|
has_many :plan_features
|
4
4
|
has_many :features, through: :plan_features
|
5
|
-
|
5
|
+
|
6
6
|
default_scope { order(:display_order) }
|
7
7
|
|
8
|
+
self.all.each do |plan|
|
9
|
+
scope plan.to_sym, -> { find_by(stripe_id: plan.stripe_id) }
|
10
|
+
end
|
11
|
+
|
8
12
|
include StripeSaas::Plan
|
9
13
|
end
|
data/lib/stripe_saas/version.rb
CHANGED
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/dummy/log/test.log
CHANGED
@@ -3426,3 +3426,107 @@ Migrating to CreatePlanFeatures (20151220161817)
|
|
3426
3426
|
[1m[35m (2.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3427
3427
|
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3428
3428
|
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3429
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3430
|
+
[1m[36m (4.8ms)[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
|
3431
|
+
[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)
|
3432
|
+
[1m[36m (1.8ms)[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
|
3433
|
+
[1m[35m (1.7ms)[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)
|
3434
|
+
[1m[36m (2.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
|
3435
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3436
|
+
[1m[36m (3.7ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3437
|
+
[1m[35m (0.2ms)[0m SELECT sql
|
3438
|
+
FROM sqlite_master
|
3439
|
+
WHERE name='index_users_on_email' AND type='index'
|
3440
|
+
UNION ALL
|
3441
|
+
SELECT sql
|
3442
|
+
FROM sqlite_temp_master
|
3443
|
+
WHERE name='index_users_on_email' AND type='index'
|
3444
|
+
|
3445
|
+
[1m[36m (2.2ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3446
|
+
[1m[35m (2.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3447
|
+
[1m[36m (1.5ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3448
|
+
[1m[35m (0.4ms)[0m SELECT version FROM "schema_migrations"
|
3449
|
+
[1m[36m (2.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3450
|
+
[1m[35m (2.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3451
|
+
[1m[36m (3.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3452
|
+
[1m[35m (2.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3453
|
+
[1m[36m (2.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3454
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3455
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3456
|
+
[1m[36m (1.0ms)[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
|
3457
|
+
[1m[35m (1.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)
|
3458
|
+
[1m[36m (1.8ms)[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
|
3459
|
+
[1m[35m (1.5ms)[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)
|
3460
|
+
[1m[36m (2.0ms)[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
|
3461
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3462
|
+
[1m[36m (1.5ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3463
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
3464
|
+
FROM sqlite_master
|
3465
|
+
WHERE name='index_users_on_email' AND type='index'
|
3466
|
+
UNION ALL
|
3467
|
+
SELECT sql
|
3468
|
+
FROM sqlite_temp_master
|
3469
|
+
WHERE name='index_users_on_email' AND type='index'
|
3470
|
+
|
3471
|
+
[1m[36m (1.2ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3472
|
+
[1m[35m (1.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3473
|
+
[1m[36m (2.4ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3474
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
3475
|
+
[1m[36m (0.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3476
|
+
[1m[35m (0.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3477
|
+
[1m[36m (0.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3478
|
+
[1m[35m (0.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3479
|
+
[1m[36m (1.2ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3480
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3481
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3482
|
+
[1m[36m (2.3ms)[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
|
3483
|
+
[1m[35m (2.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)
|
3484
|
+
[1m[36m (3.4ms)[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
|
3485
|
+
[1m[35m (3.6ms)[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)
|
3486
|
+
[1m[36m (2.9ms)[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
|
3487
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
3488
|
+
[1m[36m (2.4ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3489
|
+
[1m[35m (1.7ms)[0m SELECT sql
|
3490
|
+
FROM sqlite_master
|
3491
|
+
WHERE name='index_users_on_email' AND type='index'
|
3492
|
+
UNION ALL
|
3493
|
+
SELECT sql
|
3494
|
+
FROM sqlite_temp_master
|
3495
|
+
WHERE name='index_users_on_email' AND type='index'
|
3496
|
+
|
3497
|
+
[1m[36m (3.3ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3498
|
+
[1m[35m (1.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3499
|
+
[1m[36m (5.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3500
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
3501
|
+
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3502
|
+
[1m[35m (2.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3503
|
+
[1m[36m (4.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3504
|
+
[1m[35m (2.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3505
|
+
[1m[36m (2.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3506
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3507
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3508
|
+
[1m[36m (4.8ms)[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
|
3509
|
+
[1m[35m (1.7ms)[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)
|
3510
|
+
[1m[36m (1.6ms)[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
|
3511
|
+
[1m[35m (1.5ms)[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)
|
3512
|
+
[1m[36m (2.0ms)[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
|
3513
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3514
|
+
[1m[36m (2.4ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
3515
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
3516
|
+
FROM sqlite_master
|
3517
|
+
WHERE name='index_users_on_email' AND type='index'
|
3518
|
+
UNION ALL
|
3519
|
+
SELECT sql
|
3520
|
+
FROM sqlite_temp_master
|
3521
|
+
WHERE name='index_users_on_email' AND type='index'
|
3522
|
+
|
3523
|
+
[1m[36m (2.0ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
3524
|
+
[1m[35m (1.8ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3525
|
+
[1m[36m (1.6ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3526
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
3527
|
+
[1m[36m (1.5ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161817')[0m
|
3528
|
+
[1m[35m (1.8ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
|
3529
|
+
[1m[36m (1.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20150102001921')[0m
|
3530
|
+
[1m[35m (1.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
|
3531
|
+
[1m[36m (1.3ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20151220161809')[0m
|
3532
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|