paid_up 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -6
- data/VERSION +1 -1
- data/app/models/paid_up/plan.rb +3 -3
- data/app/models/paid_up/{features_plan.rb → plan_feature_setting.rb} +1 -1
- data/app/views/paid_up/subscriptions/new.html.haml +1 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1301 -318
- data/db/migrate/{20150407105900_create_paid_up_features_plans_table.rb → 20150407105900_create_paid_up_plan_feature_settings_table.rb} +2 -2
- data/lib/generators/paid_up/install/templates/initializer.rb +1 -1
- data/paid_up.gemspec +9 -9
- data/spec/dummy/config/initializers/paid_up.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{20150523010838_create_paid_up_features_plans_table.paid_up.rb → 20150523010838_create_paid_up_plan_feature_settings_table.paid_up.rb} +2 -2
- data/spec/dummy/db/schema.rb +3 -3
- data/spec/dummy/db/seeds/{features_plans.seeds.rb → plan_feature_settings.seeds.rb} +14 -18
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1243 -166
- data/spec/factories/plan_feature_setting.rb +7 -0
- data/spec/models/paid_up/{features_plan_spec.rb → plan_feature_setting_spec.rb} +1 -1
- data/spec/models/paid_up/plan_spec.rb +2 -2
- data/spec/support/plans_and_features.rb +14 -14
- metadata +8 -8
- data/spec/factories/features_plan.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d49bea00e60ca17806304d426b58aef6baf161d
|
4
|
+
data.tar.gz: 7262d982ce4c8c2f5cba4b027d0b42e91886603b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bacd723841bf8192b60400fe68143591863c7626e58469beda266a52bdfffa19ab86b29ee32ac0f1d44c2b5281aa8b104bff004617258c04524fc6e83081756
|
7
|
+
data.tar.gz: 91f22ec84207fbe22565b17d865b4ae7762eb0e740b9967d1c64b05599a19d4b4913961f2f06818a4430c3d11ee1de0a00656f657b68b174a7647823fc735053
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@ Paid Up is a start-to-finish Stripe subscription engine. You set up the plans yo
|
|
10
10
|
* Authentication by Devise
|
11
11
|
* Authorization by CanCan
|
12
12
|
* Subscription by Stripe
|
13
|
+
* Roles by Rolify
|
13
14
|
* Assumes you will be using some variety of Bootstrap, and designed to be quite responsive out of the box, but included views can be overridden with custom views.
|
14
15
|
|
15
16
|
## Installation
|
@@ -43,7 +44,7 @@ Next, add a `Stripe::Customer` to serve as the Anonymous User, and subscribe tha
|
|
43
44
|
|
44
45
|
## Features Setup
|
45
46
|
|
46
|
-
Set up each `PaidUp::Feature` using the config file. (A config file is used rather than using records in an `ActiveRecord::Base` model because relationships cannot be created at runtime.) Associate the features with the corresponding plans using the `PaidUp::
|
47
|
+
Set up each `PaidUp::Feature` using the config file. (A config file is used rather than using records in an `ActiveRecord::Base` model because relationships cannot be created at runtime.) Associate the features with the corresponding plans using the `PaidUp::PlanFeatureSetting` model. For an example, check out the seeds files in [`spec/dummy/db/seeds/`](spec/dummy/db/seeds/)
|
47
48
|
|
48
49
|
Possible `:setting_type` values are: `boolean`, `table_rows`, `rolify_rows`. The latter two require that a table corresponding to the feature's `:name` value.
|
49
50
|
|
@@ -63,7 +64,7 @@ In order for PaidUp's AJAX functionality to work (which is required because Stri
|
|
63
64
|
|
64
65
|
## Abilities
|
65
66
|
|
66
|
-
Abilities corresponding to features you have defined will be generated automatically, as an `:own` ability on the specified tables, if you include the PaidUp::Ability module and use the `initialize_paid_up(user)` command, like this:
|
67
|
+
Abilities corresponding to features you have defined will be generated automatically, as an `:own` ability on the specified tables, plus rational defaults for `:manage` and `:read` permissions, if you include the `PaidUp::Ability` module and use the `initialize_paid_up(user)` command, like this:
|
67
68
|
|
68
69
|
# /app/models/ability.rb
|
69
70
|
class Ability
|
@@ -74,16 +75,12 @@ Abilities corresponding to features you have defined will be generated automatic
|
|
74
75
|
user ||= User.new # anonymous user (not logged in)
|
75
76
|
|
76
77
|
# Rails Application's initialization could go here.
|
77
|
-
can :manage, Group, user: user
|
78
78
|
|
79
79
|
initialize_paid_up(user)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
Note that you will probably need to set up `:manage` and `:read` , according to your business rules.
|
84
|
-
|
85
83
|
## Contributing to Paid Up
|
86
|
-
|
87
84
|
|
88
85
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
89
86
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/app/models/paid_up/plan.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class PaidUp::Plan < ActiveRecord::Base
|
2
|
-
has_many :
|
3
|
-
has_many :features, :through => :
|
2
|
+
has_many :plan_feature_settings, class_name: 'PaidUp::PlanFeatureSetting'
|
3
|
+
has_many :features, :through => :plan_feature_settings, class_name: 'PaidUp::Feature'
|
4
4
|
has_many :subscribers, :through => :subscriptions, :source => :subscriber, :source_type => 'User'
|
5
5
|
|
6
6
|
after_initialize :load_stripe_data
|
@@ -21,7 +21,7 @@ class PaidUp::Plan < ActiveRecord::Base
|
|
21
21
|
|
22
22
|
def feature_setting(feature_name)
|
23
23
|
feature = PaidUp::Feature.find_by_slug(feature_name) || raise(:feature_not_found.l)
|
24
|
-
raw =
|
24
|
+
raw = plan_feature_settings.where(feature: feature_name)
|
25
25
|
case feature.setting_type
|
26
26
|
when 'boolean'
|
27
27
|
if raw.empty?
|
@@ -62,6 +62,7 @@
|
|
62
62
|
if (response.error) {
|
63
63
|
// Show the errors on the form
|
64
64
|
$form.find('.payment-errors').text(response.error.message);
|
65
|
+
$form.find('.payment-errors').addClass('alert alert-danger')
|
65
66
|
$('#submit-button').prop('disabled', false);
|
66
67
|
} else {
|
67
68
|
// response contains id and card, which contains additional card details
|
data/coverage/.last_run.json
CHANGED