paid_up 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da81f695f2094574cefed7cb6aaaffdd15bb9326
4
- data.tar.gz: e3c4755cf8c29caea0bde253637001751d1d096a
3
+ metadata.gz: 2d49bea00e60ca17806304d426b58aef6baf161d
4
+ data.tar.gz: 7262d982ce4c8c2f5cba4b027d0b42e91886603b
5
5
  SHA512:
6
- metadata.gz: 19f7b0cf4a1db0adc4f18272c5f32087887e95631a73986d501498f16ee7b8175749cdb8f37f22ed11e414cacc605f191dfbf0025289a4ff0a8252e3c764305d
7
- data.tar.gz: 3f64aa28876b80c9623142b8efca71e0671be455e668aae14caf1eaeb6250d268ba1b11dcc0466abb2a975f6f7df03d70e9669e8ba28a5b0ffb0817e98a189b2
6
+ metadata.gz: 8bacd723841bf8192b60400fe68143591863c7626e58469beda266a52bdfffa19ab86b29ee32ac0f1d44c2b5281aa8b104bff004617258c04524fc6e83081756
7
+ data.tar.gz: 91f22ec84207fbe22565b17d865b4ae7762eb0e740b9967d1c64b05599a19d4b4913961f2f06818a4430c3d11ee1de0a00656f657b68b174a7647823fc735053
data/README.md CHANGED
@@ -10,6 +10,7 @@ Paid Up is a start-to-finish Stripe subscription engine. You set up the plans yo
10
10
  * Authentication by Devise
11
11
  * Authorization by CanCan
12
12
  * Subscription by Stripe
13
+ * Roles by Rolify
13
14
  * Assumes you will be using some variety of Bootstrap, and designed to be quite responsive out of the box, but included views can be overridden with custom views.
14
15
 
15
16
  ## Installation
@@ -43,7 +44,7 @@ Next, add a `Stripe::Customer` to serve as the Anonymous User, and subscribe tha
43
44
 
44
45
  ## Features Setup
45
46
 
46
- 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::FeaturesPlan` model. For an example, check out the seeds files in [`spec/dummy/db/seeds/`](spec/dummy/db/seeds/)
47
+ 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 files in [`spec/dummy/db/seeds/`](spec/dummy/db/seeds/)
47
48
 
48
49
  Possible `:setting_type` values are: `boolean`, `table_rows`, `rolify_rows`. The latter two require that a table corresponding to the feature's `:name` value.
49
50
 
@@ -63,7 +64,7 @@ In order for PaidUp's AJAX functionality to work (which is required because Stri
63
64
 
64
65
  ## Abilities
65
66
 
66
- Abilities corresponding to features you have defined will be generated automatically, as an `:own` ability on the specified tables, if you include the PaidUp::Ability module and use the `initialize_paid_up(user)` command, like this:
67
+ Abilities corresponding to features you have defined will be generated automatically, as an `:own` ability on the specified tables, plus rational defaults for `:manage` and `:read` permissions, if you include the `PaidUp::Ability` module and use the `initialize_paid_up(user)` command, like this:
67
68
 
68
69
  # /app/models/ability.rb
69
70
  class Ability
@@ -74,16 +75,12 @@ Abilities corresponding to features you have defined will be generated automatic
74
75
  user ||= User.new # anonymous user (not logged in)
75
76
 
76
77
  # Rails Application's initialization could go here.
77
- can :manage, Group, user: user
78
78
 
79
79
  initialize_paid_up(user)
80
80
  end
81
81
  end
82
82
 
83
- Note that you will probably need to set up `:manage` and `:read` , according to your business rules.
84
-
85
83
  ## Contributing to Paid Up
86
-
87
84
 
88
85
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
89
86
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -1,6 +1,6 @@
1
1
  class PaidUp::Plan < ActiveRecord::Base
2
- has_many :features_plans, class_name: 'PaidUp::FeaturesPlan'
3
- has_many :features, :through => :features_plans, class_name: 'PaidUp::Feature'
2
+ has_many :plan_feature_settings, class_name: 'PaidUp::PlanFeatureSetting'
3
+ has_many :features, :through => :plan_feature_settings, class_name: 'PaidUp::Feature'
4
4
  has_many :subscribers, :through => :subscriptions, :source => :subscriber, :source_type => 'User'
5
5
 
6
6
  after_initialize :load_stripe_data
@@ -21,7 +21,7 @@ class PaidUp::Plan < ActiveRecord::Base
21
21
 
22
22
  def feature_setting(feature_name)
23
23
  feature = PaidUp::Feature.find_by_slug(feature_name) || raise(:feature_not_found.l)
24
- raw = features_plans.where(feature: feature_name)
24
+ raw = plan_feature_settings.where(feature: feature_name)
25
25
  case feature.setting_type
26
26
  when 'boolean'
27
27
  if raw.empty?
@@ -1,4 +1,4 @@
1
- class PaidUp::FeaturesPlan < ActiveRecord::Base
1
+ class PaidUp::PlanFeatureSetting < ActiveRecord::Base
2
2
  belongs_to :plan, class_name: 'PaidUp::Plan'
3
3
  validates_presence_of :setting, :plan, :feature
4
4
 
@@ -62,6 +62,7 @@
62
62
  if (response.error) {
63
63
  // Show the errors on the form
64
64
  $form.find('.payment-errors').text(response.error.message);
65
+ $form.find('.payment-errors').addClass('alert alert-danger')
65
66
  $('#submit-button').prop('disabled', false);
66
67
  } else {
67
68
  // response contains id and card, which contains additional card details
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 78.17
3
+ "covered_percent": 96.13
4
4
  }
5
5
  }