paid_up 0.13.5 → 0.13.6
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/README.md +6 -2
- data/VERSION +1 -1
- data/app/models/paid_up/ability.rb +1 -1
- data/app/models/paid_up/plan.rb +23 -7
- data/paid_up.gemspec +4 -4
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/doodad.rb +1 -1
- data/spec/factories/group.rb +1 -1
- data/spec/factories/plan.rb +3 -3
- data/spec/factories/plan_feature_setting.rb +3 -3
- data/spec/factories/post.rb +2 -2
- data/spec/factories/user.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd4aa53725c15d418c3798c8b7d8a4dea31e0ff1f114ca425d063b67896e75d2
|
4
|
+
data.tar.gz: c10e4d754c584056c161f98a164a526c33047356b2b8f0120daa5fc8b29862e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf0feabd9990f7f6259377138cd4a6f937a07c80feba530de59bcfac12d1113353de804e9b049d88620c68444883cf07287499aa6a17d9d619653437a13206e
|
7
|
+
data.tar.gz: e2c416e17d6f7b9da15da8c00c088a9c8f96c7d6a5ea4d3a26ba716de16cd67ba2428623ad0b70008be648e0e1378538a29df6db959f4b50577c24344a899673
|
data/README.md
CHANGED
@@ -104,11 +104,15 @@ Abilities corresponding to features you have defined will be generated automatic
|
|
104
104
|
|
105
105
|
## Speeding up User queries
|
106
106
|
|
107
|
-
If you try generating a list of users for display in a directory, you may find
|
108
|
-
that the Stripe checking code slows down your query.
|
107
|
+
If you try generating a list of users (such as for display in a user directory), you may find
|
108
|
+
that the Stripe checking code slows down your query significantly.
|
109
109
|
|
110
110
|
To avoid this, add "select(:field_1, :field_2, :etc)" to your finder, being
|
111
111
|
sure to *omit* the :stripe_id column.
|
112
|
+
|
113
|
+
Another option would be to create a Person model that inherits from the User model but omits the :stripe_id column
|
114
|
+
(as above) in its `default_scope`. You can use this Person object for queries related to directory or profile display,
|
115
|
+
thereby speeding up all queries not requiring plan information.
|
112
116
|
|
113
117
|
## Controller
|
114
118
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.13.
|
1
|
+
0.13.6
|
data/app/models/paid_up/plan.rb
CHANGED
@@ -11,7 +11,7 @@ module PaidUp
|
|
11
11
|
)
|
12
12
|
accepts_nested_attributes_for :plan_feature_settings
|
13
13
|
|
14
|
-
after_initialize :load_stripe_data
|
14
|
+
after_initialize :load_stripe_data, :load_feature_settings
|
15
15
|
after_save :expire_stripe_data
|
16
16
|
|
17
17
|
attr_accessor :stripe_data
|
@@ -39,19 +39,35 @@ module PaidUp
|
|
39
39
|
self
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
def load_feature_settings
|
43
|
+
@feature_settings = {}
|
44
|
+
settings = {}
|
45
|
+
|
46
|
+
plan_feature_settings.each do |feature_setting|
|
47
|
+
settings[feature_setting.feature] = feature_setting.setting
|
48
|
+
end
|
49
|
+
|
50
|
+
PaidUp::Feature.all.each do |feature|
|
51
|
+
slug = feature.slug
|
52
|
+
@feature_settings[slug] = parse_setting_by_type(feature.setting_type, settings[slug])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def parse_setting_by_type(setting_type, setting)
|
57
|
+
case setting_type
|
46
58
|
when 'boolean'
|
47
|
-
|
59
|
+
setting == 1
|
48
60
|
when 'table_rows', 'rolify_rows'
|
49
|
-
|
61
|
+
setting || 0
|
50
62
|
else
|
51
63
|
raise :error_handling_feature_setting.l feature: feature
|
52
64
|
end
|
53
65
|
end
|
54
66
|
|
67
|
+
def feature_setting(feature_name)
|
68
|
+
@feature_settings[feature_name]
|
69
|
+
end
|
70
|
+
|
55
71
|
def feature_unlimited?(feature_name)
|
56
72
|
feature_setting(feature_name) == PaidUp::Unlimited.to_i
|
57
73
|
end
|
data/paid_up.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: paid_up 0.13.
|
5
|
+
# stub: paid_up 0.13.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "paid_up".freeze
|
9
|
-
s.version = "0.13.
|
9
|
+
s.version = "0.13.6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Karen Lundgren".freeze]
|
14
|
-
s.date = "2018-
|
14
|
+
s.date = "2018-09-09"
|
15
15
|
s.description = "Allows a model of your choosing (such as users) to subscribe to a plan, which enables features.".freeze
|
16
16
|
s.email = "karen.e.lundgren@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -177,7 +177,7 @@ Gem::Specification.new do |s|
|
|
177
177
|
]
|
178
178
|
s.homepage = "http://www.gemvein.com/museum/cases/paid_up".freeze
|
179
179
|
s.licenses = ["MIT".freeze]
|
180
|
-
s.rubygems_version = "2.7.
|
180
|
+
s.rubygems_version = "2.7.7".freeze
|
181
181
|
s.summary = "Allows a model of your choosing to subscribe to a plan, which enables features.".freeze
|
182
182
|
|
183
183
|
if s.respond_to? :specification_version then
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/factories/doodad.rb
CHANGED
data/spec/factories/group.rb
CHANGED
data/spec/factories/plan.rb
CHANGED
data/spec/factories/post.rb
CHANGED
data/spec/factories/user.rb
CHANGED
@@ -5,11 +5,11 @@ FactoryBot.define do
|
|
5
5
|
sequence :email do |n|
|
6
6
|
"#{name.tr(' ', '.').downcase}#{n}@example.com"
|
7
7
|
end
|
8
|
-
password 'password'
|
9
|
-
password_confirmation 'password'
|
8
|
+
password { 'password' }
|
9
|
+
password_confirmation { 'password' }
|
10
10
|
transient do
|
11
11
|
plan { PaidUp::Plan.all.sample }
|
12
|
-
past_due false
|
12
|
+
past_due { false }
|
13
13
|
end
|
14
14
|
# the after(:create) yields two values; the user instance itself and the
|
15
15
|
# evaluator, which stores all values from the factory, including transient
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paid_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karen Lundgren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml-rails
|
@@ -664,7 +664,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
664
664
|
version: '0'
|
665
665
|
requirements: []
|
666
666
|
rubyforge_project:
|
667
|
-
rubygems_version: 2.7.
|
667
|
+
rubygems_version: 2.7.7
|
668
668
|
signing_key:
|
669
669
|
specification_version: 4
|
670
670
|
summary: Allows a model of your choosing to subscribe to a plan, which enables features.
|