plan_features 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07bd254cc2719b84d37ac6a37f197e7c90e8c7ac54c5a27d92b4599a63773f95
4
- data.tar.gz: a7efa17ace3fa438a0da2df4e7928558d9f72aad8f941c768f73a0d858a58afc
3
+ metadata.gz: 500cb4693e7ccbe5af5b6ac882c5e0ef6e26a954be886c50727fe321df182e8b
4
+ data.tar.gz: f79ec09d1598fc35f9ad7bc2cf24a69ae6f743c6f2b64f64f14e8676e43473d6
5
5
  SHA512:
6
- metadata.gz: a1fea6c3e978ace802ff4658ec1f692ae9035bb68f84a6f19ade4c3b51c79d46ed399aeecdd019e1d850c8232fcd34b06717e14ca23aa419b92f97ab2db6ea65
7
- data.tar.gz: d970c2cb9c7b452f8f48780cc7eb763075a602bf01cca2fd91cc0191f00327f881d631eb880f590a49eff65a9ea8eb873556764df5100524c6b60cb7da26ae89
6
+ metadata.gz: 50a50907f7408157ebf2a1a6fbc0e75223294b8b3795ad6eb61c28236da9cd2dda6f1766e852ea9c894c2f37433fc12d72f33d077e9a1b506466ea81c0462bfd
7
+ data.tar.gz: 4bd1b29a1a5701738e08f547736fa3d8dc22f57652c978aaa5ce796910f83f7abf0ca0e627e34287cc4fecb394f47f8a959d1cddcb74877edd88931bec2ece5b
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, :popular
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
@@ -1,3 +1,3 @@
1
1
  module PlanFeatures
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.0
4
+ version: 0.3.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-10 00:00:00.000000000 Z
11
+ date: 2023-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails