bullet_train 1.34.1 → 1.36.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/app/models/concerns/invitations/base.rb +11 -0
- data/app/models/concerns/teams/base.rb +0 -1
- data/app/models/concerns/users/base.rb +7 -0
- data/docs/action-models.md +4 -11
- data/docs/billing/stripe.md +4 -29
- data/docs/billing/usage.md +9 -16
- data/lib/bullet_train/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c1d33c15093050889618d0a58e53899f22dbbee55e6792adad049b36107eec6
|
|
4
|
+
data.tar.gz: a7a547ddbb60545ee9b2f37e984aa1b293a84ddd231a3233542ea85e5a2c5a61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dafe1f7e4ec075acbd7fd8417a2080b7dc51c496eaf2b8d3b63e14262d9a43b2bce61e8ed8b42678688ba48c4346026c2ae3ce87e4b778532e7bec7931dab8e7
|
|
7
|
+
data.tar.gz: f25805b74ba7e7f77ccadfe2404350a312f6de5d4f223b4940f8a881c5017cccc4aa2d348fa9fca3acd3a247d2fd9b994b85dfa63b1d0c46727ee683ea85e9e8
|
|
@@ -14,6 +14,8 @@ module Invitations::Base
|
|
|
14
14
|
after_create :set_added_by_membership
|
|
15
15
|
after_create :send_invitation_email
|
|
16
16
|
|
|
17
|
+
after_validation :hoist_membership_email_error
|
|
18
|
+
|
|
17
19
|
attribute :uuid, default: -> { SecureRandom.hex }
|
|
18
20
|
|
|
19
21
|
def roles
|
|
@@ -44,4 +46,13 @@ module Invitations::Base
|
|
|
44
46
|
def is_for?(user)
|
|
45
47
|
user.email.downcase.strip == email.downcase.strip
|
|
46
48
|
end
|
|
49
|
+
|
|
50
|
+
def hoist_membership_email_error
|
|
51
|
+
# This is special handling for the email field because we have a uniqueness validation in the
|
|
52
|
+
# `Membership` model for the `user_email` field. Since we copy the value from `invitation.email`
|
|
53
|
+
# into `invitation.membership.user_email` the error isn't passed through to the form in the normal way.
|
|
54
|
+
errors[:"membership.user_email"]&.each do |error|
|
|
55
|
+
errors.add(:email, error)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
47
58
|
end
|
|
@@ -44,6 +44,7 @@ module Users::Base
|
|
|
44
44
|
# callbacks
|
|
45
45
|
after_validation :remove_profile_photo, if: :profile_photo_removal?
|
|
46
46
|
after_update :set_teams_time_zone
|
|
47
|
+
after_update :set_memberships_email
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def email_is_oauth_placeholder?
|
|
@@ -159,6 +160,12 @@ module Users::Base
|
|
|
159
160
|
end
|
|
160
161
|
end
|
|
161
162
|
|
|
163
|
+
def set_memberships_email
|
|
164
|
+
if email_previously_changed?
|
|
165
|
+
memberships.where.not(user_email: email).update(user_email: email)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
162
169
|
def profile_photo_removal?
|
|
163
170
|
profile_photo_removal.present?
|
|
164
171
|
end
|
data/docs/action-models.md
CHANGED
|
@@ -42,18 +42,11 @@ end
|
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
We recently fully open-sourced our PRO-level features, but haven't yet merged these projects into our core repo. Until we do, you can install the action-model gem via git.
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Then you can specify the Ruby gem in your `Gemfile`:
|
|
52
|
-
|
|
53
|
-
```ruby
|
|
54
|
-
source "https://YOUR_TOKEN_HERE@gem.fury.io/bullettrain" do
|
|
55
|
-
gem "bullet_train-action_models"
|
|
56
|
-
end
|
|
47
|
+
```
|
|
48
|
+
# Below the comment labelled YOUR GEMS in your Gemfile
|
|
49
|
+
gem "bullet_train-action_models", git: "https://github.com/bullet-train-pro/bullet_train-action_models.git"
|
|
57
50
|
```
|
|
58
51
|
|
|
59
52
|
Don't forget to run `bundle install` and `rails restart`.
|
data/docs/billing/stripe.md
CHANGED
|
@@ -4,34 +4,11 @@ When you're ready to start billing customers for the product you've created with
|
|
|
4
4
|
|
|
5
5
|
We also provide a Stripe-specific adapter package with support for auto-configuring those products and prices in your Stripe account. It also takes advantage of completely modern Stripe workflows, like allowing customers to purchase your product with Stripe Checkout and later manage their subscription using Stripe Billing's customer portal. It also automatically handles incoming Stripe webhooks as well, to keep subscription state in your application up-to-date with activity that has happened on Stripe's platform.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Install the Bullet Train Billing gems via git
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
We recently fully open-sourced our PRO-level features, but haven't yet merged these projects into our core repo. Until we do, you can install the billing gems via git.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### A.2. Add the Private Ruby Gems
|
|
14
|
-
|
|
15
|
-
You'll need to specify both Ruby gems in your `Gemfile`, since we have to specify a private source for both:
|
|
16
|
-
|
|
17
|
-
```ruby
|
|
18
|
-
source "https://YOUR_TOKEN_HERE@gem.fury.io/bullettrain" do
|
|
19
|
-
gem "bullet_train-billing"
|
|
20
|
-
gem "bullet_train-billing-stripe"
|
|
21
|
-
end
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### A.3. Bundle Install
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
bundle install
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Proceed to the [Installation Instructions](#installation-instructions) section below**
|
|
31
|
-
|
|
32
|
-
## Option B: Using the Open Source version of Bullet Train Billing via git
|
|
33
|
-
|
|
34
|
-
### B.1. Add the Git Repositories
|
|
11
|
+
### 1. Add the gems via git
|
|
35
12
|
|
|
36
13
|
```
|
|
37
14
|
# Below the comment labelled YOUR GEMS in your Gemfile
|
|
@@ -39,7 +16,7 @@ gem "bullet_train-billing", git: "https://github.com/bullet-train-pro/bullet_tra
|
|
|
39
16
|
gem "bullet_train-billing-stripe", git: "https://github.com/bullet-train-pro/bullet_train-billing-stripe.git"
|
|
40
17
|
```
|
|
41
18
|
|
|
42
|
-
###
|
|
19
|
+
### 2. Bundle Install
|
|
43
20
|
|
|
44
21
|
```
|
|
45
22
|
bundle install
|
|
@@ -54,8 +31,6 @@ Fetching gem metadata from https://rubygems.org/........
|
|
|
54
31
|
<all of your normal gems>
|
|
55
32
|
```
|
|
56
33
|
|
|
57
|
-
**Proceed to the [Installation Instructions](#installation-instructions) section below**
|
|
58
|
-
|
|
59
34
|
## Installation Instructions
|
|
60
35
|
|
|
61
36
|
### Prerequisites
|
data/docs/billing/usage.md
CHANGED
|
@@ -4,31 +4,24 @@ Bullet Train provides a holistic method for defining model-based usage limits in
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
### 1.
|
|
7
|
+
### 1. Add the gems via git
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
We recently fully open-sourced our PRO-level features, but haven't yet merged these projects into our core repo. Until we do, you can install the action-model gem via git.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```ruby
|
|
18
|
-
source "https://YOUR_TOKEN_HERE@gem.fury.io/bullettrain" do
|
|
19
|
-
gem "bullet_train-billing"
|
|
20
|
-
gem "bullet_train-billing-stripe" # Or whichever billing provider you're using.
|
|
21
|
-
gem "bullet_train-billing-usage"
|
|
22
|
-
end
|
|
11
|
+
```
|
|
12
|
+
# Below the comment labelled YOUR GEMS in your Gemfile
|
|
13
|
+
gem "bullet_train-billing", git: "https://github.com/bullet-train-pro/bullet_train-billing.git"
|
|
14
|
+
gem "bullet_train-billing-stripe", git: "https://github.com/bullet-train-pro/bullet_train-billing-stripe.git"
|
|
15
|
+
gem "bullet_train-billing-usage", git: "https://github.com/bullet-train-pro/bullet_train-billing-usage.git"
|
|
23
16
|
```
|
|
24
17
|
|
|
25
|
-
### 2.
|
|
18
|
+
### 2. Bundle Install
|
|
26
19
|
|
|
27
20
|
```
|
|
28
21
|
bundle install
|
|
29
22
|
```
|
|
30
23
|
|
|
31
|
-
###
|
|
24
|
+
### 3. Copy Database Migrations
|
|
32
25
|
|
|
33
26
|
Use the following two commands on your shell to copy the required migrations into your local project:
|
|
34
27
|
|
data/lib/bullet_train/version.rb
CHANGED