paid_up 0.6.5 → 0.7.0
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/models/paid_up/ability.rb +4 -2
- data/app/models/paid_up/plan.rb +8 -1
- data/config/locales/en.yml +1 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +282 -1387
- data/lib/paid_up/mixins/paid_for.rb +51 -1
- data/lib/paid_up/mixins/subscriber.rb +6 -1
- data/paid_up.gemspec +6 -3
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150517175135_create_groups_table.rb +1 -1
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +241 -0
- data/spec/factories/group.rb +5 -0
- data/spec/models/group_spec.rb +54 -0
- data/spec/support/groups.rb +34 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8689399aa48f6a2bf96a908d2b70d9c7b3f96d5d
|
4
|
+
data.tar.gz: f07c881f81209410ad94a5caebe4cecdf76ff601
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18f089742dce778bad7fc3a799ba2fa645ec213b7b6aeb40817c00caf58009f4ac614fb63de123d0840e55ae41a2cfdc85b080d5cf712997eaf2e4b8d3cb27b7
|
7
|
+
data.tar.gz: c4f53fb93a8fb63094ad45dba4aa5976bb0d42a7e80390b71f5a5a477fa11337df093a3a25064aebbaa8260a7e3c42c9100212200ff377fb27fecf81f34f3ca7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
@@ -7,7 +7,8 @@ module PaidUp
|
|
7
7
|
for feature in features
|
8
8
|
case feature.setting_type
|
9
9
|
when 'table_rows'
|
10
|
-
can
|
10
|
+
can :index, feature.feature_model
|
11
|
+
can :read, feature.feature_model, enabled: true
|
11
12
|
if user.table_rows_allowed(feature.slug) > 0 || user.table_rows_unlimited?(feature.slug)
|
12
13
|
can :manage, feature.feature_model, :user => user
|
13
14
|
can :own, feature.feature_model
|
@@ -21,7 +22,8 @@ module PaidUp
|
|
21
22
|
cannot :create, feature.feature_model
|
22
23
|
end
|
23
24
|
when 'rolify_rows'
|
24
|
-
can
|
25
|
+
can :index, feature.feature_model
|
26
|
+
can :read, feature.feature_model, enabled: true
|
25
27
|
if user.rolify_rows_allowed(feature.slug) > 0 || user.rolify_rows_unlimited?(feature.slug)
|
26
28
|
can :manage, feature.feature_model, id: Group.with_role(:owner, user).pluck(:id)
|
27
29
|
can :own, feature.feature_model
|
data/app/models/paid_up/plan.rb
CHANGED
@@ -3,6 +3,7 @@ class PaidUp::Plan < ActiveRecord::Base
|
|
3
3
|
accepts_nested_attributes_for :plan_feature_settings
|
4
4
|
|
5
5
|
after_initialize :load_stripe_data
|
6
|
+
after_save :expire_stripe_data
|
6
7
|
|
7
8
|
attr_accessor :stripe_data
|
8
9
|
|
@@ -87,8 +88,14 @@ class PaidUp::Plan < ActiveRecord::Base
|
|
87
88
|
|
88
89
|
def load_stripe_data
|
89
90
|
if stripe_id.present?
|
90
|
-
self.stripe_data =
|
91
|
+
self.stripe_data = Rails.cache.fetch("#{stripe_id}/stripe_data", expires_in: 12.hours) do
|
92
|
+
Stripe::Plan.retrieve stripe_id
|
93
|
+
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
97
|
+
def expire_stripe_data
|
98
|
+
Rails.cache.delete("#{stripe_id}/stripe_data")
|
99
|
+
end
|
100
|
+
|
94
101
|
end
|
data/config/locales/en.yml
CHANGED
@@ -55,6 +55,7 @@ en:
|
|
55
55
|
my_subscription: 'My Subscription'
|
56
56
|
my_subscription_information: 'My Subscription Information'
|
57
57
|
no_implicit_conversion_of_type_features: 'No implicit conversion of %{type} Features'
|
58
|
+
no_features_associated_with_table: 'No features associated with %{table} table.'
|
58
59
|
or_sign_in: "Or, Sign In"
|
59
60
|
or_sign_up: "Or, Sign Up"
|
60
61
|
paid_thru: "Paid Thru"
|
data/coverage/.last_run.json
CHANGED