paid_up 0.10.4 → 0.11.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 +12 -2
- data/VERSION +1 -1
- data/app/helpers/paid_up/plans_helper.rb +0 -1
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +280 -109
- data/lib/paid_up/mixins/paid_for.rb +23 -4
- data/lib/paid_up/mixins/subscriber.rb +4 -3
- data/paid_up.gemspec +9 -3
- data/spec/dummy/app/models/group.rb +3 -1
- data/spec/dummy/app/models/post.rb +5 -0
- data/spec/dummy/config/initializers/paid_up.rb +6 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20170219225950_create_posts_table.rb +11 -0
- data/spec/dummy/db/migrate/20170220001913_add_active_column_to_groups.rb +6 -0
- data/spec/dummy/db/schema.rb +69 -55
- data/spec/dummy/db/seeds.rb +80 -7
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/post.rb +7 -0
- data/spec/models/paid_up/feature_spec.rb +10 -2
- data/spec/models/scope_spec.rb +33 -0
- data/spec/models/user_spec.rb +2 -1
- data/spec/support/loaded_site/features.rb +2 -1
- data/spec/support/loaded_site/loaded_site.rb +1 -0
- data/spec/support/loaded_site/posts.rb +7 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecf88d9efba484eeafc8c1bd652e93acc7f81eb4
|
4
|
+
data.tar.gz: 756c9d2d884bb40d6d1800303a3cc4203d6953ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46314744d7658c2d2d0a8a377bccfad7f8330085d86dcca112ede7b6fc82f89d7c8e22a310dcf1e77a6bb141e9b7499984a0b6cd09abbc9f19cd6b5351eb7533
|
7
|
+
data.tar.gz: 38dbe93a7dc0446d312452bace08dff474e5908530b3eda1edaf85221c04a48b5705ebb9ba3fd27f15ccaa375a46e23bc24bac41f2fc228e8ec5c81ce2247427
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Paid Up is a start-to-finish Stripe subscription engine. You set up the plans an
|
|
12
12
|
* Subscription by Stripe
|
13
13
|
* Roles by Rolify
|
14
14
|
* Uses Google Tag Manager for Google Analytics `dataLayer` object to provide e-commerce analytics.
|
15
|
-
* Assumes you will be using some variety of Bootstrap, and designed to be quite responsive out of the box
|
15
|
+
* Assumes you will be using some variety of Bootstrap, and designed to be quite responsive out of the box. Included views can be overridden with custom views.
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
@@ -52,7 +52,7 @@ Pay close attention to the settings in `Account Settings` under `Subscriptions`
|
|
52
52
|
|
53
53
|
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 file at [`spec/dummy/db/seeds.db`](spec/dummy/db/seeds.db)
|
54
54
|
|
55
|
-
Possible `:setting_type` values are: `boolean`, `table_rows`, `rolify_rows`. The latter two require
|
55
|
+
Possible `:setting_type` values are: `boolean`, `table_rows`, `rolify_rows`. The latter two require a table corresponding to the feature's `:name` value.
|
56
56
|
|
57
57
|
#### Setting Type: Table Rows
|
58
58
|
|
@@ -62,6 +62,16 @@ In the `table_rows` case, the table and its model must exist. the table should h
|
|
62
62
|
|
63
63
|
In the `rolify_rows` case, the table and its model must also exist. Once that is done and the corresponding `PaidUp::Feature` is created, add `paid_for` to the model. This means the resource model will run the `resourcify` method, and the User method will have had the `rolify` method added to it during install, so no further setup is required.
|
64
64
|
|
65
|
+
#### Scope
|
66
|
+
|
67
|
+
If you only want to count certain records against a user's tally, for example only records with `active` set to `true`, you can add the scope option with a symbol corresponding to the desired method or scope, like so:
|
68
|
+
|
69
|
+
class Post < ActiveRecord::Base
|
70
|
+
paid_for scope: :active
|
71
|
+
scope :active, -> { where(active: true) }
|
72
|
+
end
|
73
|
+
|
74
|
+
|
65
75
|
## Enabling Javascript
|
66
76
|
|
67
77
|
In order for PaidUp's AJAX functionality to work (which is required because Stripe uses AJAX), you will need to add this to your layout file, preferably near the end of the <body> element (for speed reasons):
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
data/coverage/.last_run.json
CHANGED