plan_features 0.2.0 → 0.4.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/README.md +11 -0
- data/lib/plan_features/pricing.rb +4 -4
- data/lib/plan_features/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 933f122a502003c040a93b139504dab852420e39aef6924eb98315c5ec050c23
|
|
4
|
+
data.tar.gz: 60b5d33a06068363db0be20d10f04b0aa95cdb4d6b5e767091735ff4cf7b36f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bdd83eee10774dcdf1ca0f9999772a112f58549dd429c5ea9deb411acc2fe75bba7826ad2c4082b2b0b476c99e9a0debe1d73ec02550733419547097a3c5c780
|
|
7
|
+
data.tar.gz: 777675e2816585d93a4f219be4b4b8e64975393ae7c4efe8aafbe962be8cc406f6b5d4876683fbe96d584f80b7b89e1af59389c49751c7015b9453b633a437dd
|
data/README.md
CHANGED
|
@@ -100,6 +100,17 @@ paid_plan.limit_for(:posts)
|
|
|
100
100
|
# => 50
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
### Metadata
|
|
104
|
+
|
|
105
|
+
You can add metadata to a plan by using the `metadata` key. Example:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
paid:
|
|
109
|
+
name: "Paid"
|
|
110
|
+
metadata:
|
|
111
|
+
popular: true
|
|
112
|
+
```
|
|
113
|
+
|
|
103
114
|
## Installation
|
|
104
115
|
|
|
105
116
|
Add this line to your application's Gemfile:
|
|
@@ -2,7 +2,7 @@ require_relative "feature"
|
|
|
2
2
|
|
|
3
3
|
module PlanFeatures
|
|
4
4
|
class Pricing
|
|
5
|
-
attr_accessor :name, :plan_identifier, :interval, :stripe_id, :features, :prices, :previous, :
|
|
5
|
+
attr_accessor :name, :plan_identifier, :interval, :stripe_id, :features, :prices, :previous, :metadata
|
|
6
6
|
|
|
7
7
|
include ActiveModel::Model
|
|
8
8
|
|
|
@@ -29,11 +29,11 @@ module PlanFeatures
|
|
|
29
29
|
@all_plans ||= YAML.load_file(::PlanFeatures.configuration.plans_file_path).map do |plan, attributes|
|
|
30
30
|
Pricing.new(
|
|
31
31
|
plan_identifier: plan,
|
|
32
|
-
popular: attributes["popular"],
|
|
33
32
|
name: attributes["name"],
|
|
34
33
|
features: attributes["features"],
|
|
35
34
|
prices: attributes["prices"],
|
|
36
|
-
previous: attributes["previous"]
|
|
35
|
+
previous: attributes["previous"],
|
|
36
|
+
metadata: attributes["metadata"]&.with_indifferent_access,
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -63,7 +63,7 @@ module PlanFeatures
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def limit_for(feature)
|
|
66
|
-
features.dig(feature.to_s, "limit")
|
|
66
|
+
features.dig(feature.to_s, "limit") || 0
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def free?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plan_features
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jesper Christiansen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-11-
|
|
11
|
+
date: 2023-11-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|