slack-ruby-bot-server-stripe 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger.yml +22 -0
  3. data/.github/workflows/rubocop.yml +18 -0
  4. data/.github/workflows/test-mongodb.yml +36 -0
  5. data/.github/workflows/test-postgresql.yml +37 -0
  6. data/.rubocop.yml +0 -3
  7. data/.rubocop_todo.yml +1 -1
  8. data/CHANGELOG.md +7 -1
  9. data/Dangerfile +2 -0
  10. data/Gemfile +6 -7
  11. data/Gemfile.danger +6 -0
  12. data/README.md +50 -28
  13. data/Rakefile +2 -0
  14. data/lib/slack-ruby-bot-server/api/endpoints.rb +2 -0
  15. data/lib/slack-ruby-bot-server/api/presenters/root_presenter.rb +2 -0
  16. data/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb +3 -1
  17. data/lib/slack-ruby-bot-server/api/presenters.rb +2 -0
  18. data/lib/slack-ruby-bot-server/api.rb +2 -0
  19. data/lib/slack-ruby-bot-server-stripe/api/endpoints/subscriptions_endpoint.rb +2 -0
  20. data/lib/slack-ruby-bot-server-stripe/api/endpoints.rb +2 -0
  21. data/lib/slack-ruby-bot-server-stripe/api.rb +2 -0
  22. data/lib/slack-ruby-bot-server-stripe/commands/subscription.rb +2 -0
  23. data/lib/slack-ruby-bot-server-stripe/commands/unsubscribe.rb +2 -0
  24. data/lib/slack-ruby-bot-server-stripe/commands.rb +2 -0
  25. data/lib/slack-ruby-bot-server-stripe/config.rb +2 -0
  26. data/lib/slack-ruby-bot-server-stripe/errors.rb +2 -0
  27. data/lib/slack-ruby-bot-server-stripe/lifecycle.rb +2 -0
  28. data/lib/slack-ruby-bot-server-stripe/models/activerecord.rb +2 -0
  29. data/lib/slack-ruby-bot-server-stripe/models/methods.rb +35 -14
  30. data/lib/slack-ruby-bot-server-stripe/models/mongoid.rb +3 -1
  31. data/lib/slack-ruby-bot-server-stripe/models.rb +2 -0
  32. data/lib/slack-ruby-bot-server-stripe/version.rb +3 -1
  33. data/lib/slack-ruby-bot-server-stripe.rb +3 -1
  34. data/slack-ruby-bot-server-stripe.gemspec +3 -1
  35. metadata +15 -11
  36. data/.travis.yml +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b590c6a22b2c9af304f57df7b5e2549fd313877cd61c61790419ed9bba3a21e7
4
- data.tar.gz: cb016ad20cc78d2f456b36177b018a3211e2453e168b0bd6e5b455c4e192f675
3
+ metadata.gz: abaa810ab12725f74b0b6de143d2ac40e14fa283cfbbcb6813b59798b3a4938a
4
+ data.tar.gz: 67d29ebad4aecdbf56dacdfafd9e46bbd270b653d357ee1ca9f80c3fd3670675
5
5
  SHA512:
6
- metadata.gz: d1a9b2c0a58181f9f41f60d3e317ad1233d19ea76c16ddafaed129d900c263fe0fd8e58698ba2a627be8579902f4c8e2b80a5356e855aa456eb18522fb5a54f7
7
- data.tar.gz: fb0f0f5e861bbab49ac4a88234d2ca34013e9e6164d3ae93a532e72673674893682ced9d59a1d0b6cb44003ab3ff8f655809ec995a042c849b7ccfc4fa0d2ad9
6
+ metadata.gz: 368fd14b120ee31a7318451e57ac48831490c73017b4f6615230a00bb9aa38b3ea7062bce0811021250f9b7fe6c37e12c3555b6ec5feec400957c0a5353ecb08
7
+ data.tar.gz: 33db5078e9d322f9d48025f503dc00a63cbffcf81c9dc4ad72a5630b5b347412ff93cb68a6ceb8f9653d89eb632f77f440cb25682640feb0f34d2a476ae8aae6
@@ -0,0 +1,22 @@
1
+ name: PR Lint
2
+ on: pull_request
3
+ jobs:
4
+ danger:
5
+ name: Dangerfile
6
+ runs-on: ubuntu-latest
7
+ env:
8
+ BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@v3
12
+ with:
13
+ fetch-depth: 0
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.7.7
18
+ bundler-cache: true
19
+ - run: |
20
+ # Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
21
+ TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
22
+ DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
@@ -0,0 +1,18 @@
1
+ name: rubocop
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ rubocop:
7
+ name: RuboCop
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@v3
12
+ - name: Set up Ruby
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: "2.7.7"
16
+ bundler-cache: true
17
+ - name: Run RuboCop
18
+ run: bundle exec rubocop
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: test-mongodb
3
+
4
+ on: [push, pull_request]
5
+
6
+ jobs:
7
+ test-mongodb:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@v3
12
+ - name: Setup Firefox
13
+ uses: browser-actions/setup-firefox@latest
14
+ with:
15
+ firefox-version: "108.0"
16
+ - name: Download geckodriver
17
+ uses: browser-actions/setup-geckodriver@latest
18
+ with:
19
+ geckodriver-version: '0.32.0'
20
+ - run: geckodriver --version
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: "2.7.7"
24
+ - name: Start MongoDB
25
+ uses: supercharge/mongodb-github-action@1.7.0
26
+ with:
27
+ mongodb-version: "5"
28
+ mongodb-db: slack-ruby-bot-server-stripe_test
29
+ - name: Test
30
+ uses: GabrielBB/xvfb-action@v1
31
+ env:
32
+ DATABASE_ADAPTER: mongoid
33
+ with:
34
+ run: |
35
+ bundle install
36
+ bundle exec rake
@@ -0,0 +1,37 @@
1
+ name: test-postgresql
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test-postgresql:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: Checkout
10
+ uses: actions/checkout@v3
11
+ - name: Setup Firefox
12
+ uses: browser-actions/setup-firefox@latest
13
+ with:
14
+ firefox-version: "108.0"
15
+ - name: Download geckodriver
16
+ uses: browser-actions/setup-geckodriver@latest
17
+ with:
18
+ geckodriver-version: '0.32.0'
19
+ - run: geckodriver --version
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: "2.7.7"
23
+ - uses: harmon758/postgresql-action@v1
24
+ with:
25
+ postgresql version: "14"
26
+ postgresql db: slack_ruby_bot_server_stripe__test
27
+ postgresql user: test
28
+ postgresql password: password
29
+ - name: Test
30
+ uses: GabrielBB/xvfb-action@v1
31
+ env:
32
+ DATABASE_ADAPTER: activerecord
33
+ DATABASE_URL: postgres://test:password@127.0.0.1:5432/slack_ruby_bot_server_stripe__test
34
+ with:
35
+ run: |
36
+ bundle install
37
+ bundle exec rake spec
data/.rubocop.yml CHANGED
@@ -8,9 +8,6 @@ Layout/LineLength:
8
8
  Style/Documentation:
9
9
  Enabled: false
10
10
 
11
- Style/FrozenStringLiteralComment:
12
- Enabled: false
13
-
14
11
  Style/ModuleFunction:
15
12
  EnforcedStyle: extend_self
16
13
 
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-04-26 19:57:20 -0400 using RuboCop version 0.81.0.
3
+ # on 2020-04-26 21:44:00 -0400 using RuboCop version 0.81.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### Changelog
2
2
 
3
- #### 0.1.0 (4/26/2020)
3
+ #### 0.2.0 (2023/11/15)
4
+
5
+ * [#16](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/pull/16): Subscription expired without any active subscriptions - [@dblock](https://github.com/dblock).
6
+ * [#15](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/pull/15): Fix: display past due subscriptions - [@dblock](https://github.com/dblock).
7
+ * [#14](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/pull/14): Migrate to GHA - [@duffn](https://github.com/duffn).
8
+
9
+ #### 0.1.0 (2020/04/26)
4
10
 
5
11
  * Initial public release - [@dblock](https://github.com/dblock).
data/Dangerfile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  danger.import_dangerfile(gem: 'slack-ruby-danger')
data/Gemfile CHANGED
@@ -1,15 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  case ENV['DATABASE_ADAPTER']
4
6
  when 'mongoid' then
5
7
  gem 'kaminari-mongoid'
6
- gem 'mongoid'
8
+ gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.3.0'
7
9
  gem 'mongoid-scroll'
8
10
  when 'activerecord' then
9
11
  gem 'activerecord', '~> 5.0.0'
10
12
  gem 'otr-activerecord', '~> 1.2.1'
11
- gem 'virtus'
12
- gem 'cursor_pagination' # rubocop:disable Bundler/OrderedGems
13
+ gem 'pagy_cursor'
13
14
  gem 'pg'
14
15
  when nil
15
16
  warn "Missing ENV['DATABASE_ADAPTER']."
@@ -27,6 +28,7 @@ group :development, :test do
27
28
  gem 'faker'
28
29
  gem 'hyperclient'
29
30
  gem 'rack-test'
31
+ gem 'rackup'
30
32
  gem 'rake'
31
33
  gem 'rspec'
32
34
  gem 'rubocop', '0.81.0'
@@ -35,8 +37,5 @@ group :development, :test do
35
37
  gem 'timecop'
36
38
  gem 'vcr'
37
39
  gem 'webmock'
38
- end
39
-
40
- group :test do
41
- gem 'slack-ruby-danger', '~> 0.1.0', require: false
40
+ gem 'webrick'
42
41
  end
data/Gemfile.danger ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'danger-toc', '~> 0.2.0', require: false
5
+ gem 'slack-ruby-danger', '~> 0.2.0', require: false
6
+ end
data/README.md CHANGED
@@ -2,10 +2,57 @@ Slack Ruby Bot Server Stripe Extension
2
2
  ======================================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server-stripe.svg)](https://badge.fury.io/rb/slack-ruby-bot-server-stripe)
5
- [![Build Status](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-stripe.svg?branch=master)](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-stripe)
5
+ [![mongodb](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-mongodb.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-mongodb.yml)
6
+ [![postgresql](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-postgresql.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-postgresql.yml)
7
+ [![rubocop](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/rubocop.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/rubocop.yml)
6
8
 
7
9
  A model extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that enables trials and paid subscriptions for your bots using [Stripe](https://stripe.com).
8
10
 
11
+ # Table of Contents
12
+
13
+ - [Sample](#sample)
14
+ - [Usage](#usage)
15
+ - [Gemfile](#gemfile)
16
+ - [Configure](#configure)
17
+ - [Database Schema](#database-schema)
18
+ - [Mongoid](#mongoid)
19
+ - [ActiveRecord](#activerecord)
20
+ - [Implement Callbacks](#implement-callbacks)
21
+ - [Add Trial Link](#add-trial-link)
22
+ - [Attributes](#attributes)
23
+ - [stripe_customer_id](#stripe_customer_id)
24
+ - [subscribed](#subscribed)
25
+ - [subscription_expired_at](#subscription_expired_at)
26
+ - [trial_informed_at](#trial_informed_at)
27
+ - [trial_ends_at](#trial_ends_at)
28
+ - [Methods](#methods)
29
+ - [trial_text](#trial_text)
30
+ - [subscribed_text](#subscribed_text)
31
+ - [unsubscribed_text](#unsubscribed_text)
32
+ - [subscription_expired_text](#subscription_expired_text)
33
+ - [subscription_past_due_text](#subscription_past_due_text)
34
+ - [trial_expired?](#trial_expired)
35
+ - [remaining_trial_days](#remaining_trial_days)
36
+ - [subscription_expired?](#subscription_expired)
37
+ - [tags](#tags)
38
+ - [active_stripe_subscription](#active_stripe_subscription)
39
+ - [active_stripe_subscription?](#active_stripe_subscription-1)
40
+ - [subscription_text(params)](#subscription_textparams)
41
+ - [subscribe!(params)](#subscribeparams)
42
+ - [unsubscribe!](#unsubscribe)
43
+ - [update_subscription!(params)](#update_subscriptionparams)
44
+ - [Lifecycle Methods](#lifecycle-methods)
45
+ - [check_subscription!](#check_subscription)
46
+ - [check_trials!](#check_trials)
47
+ - [API Endpoints](#api-endpoints)
48
+ - [POST /subscriptions](#post-subscriptions)
49
+ - [HTML Views](#html-views)
50
+ - [/subscribe](#subscribe)
51
+ - [Slack Commands](#slack-commands)
52
+ - [subscription](#subscription)
53
+ - [unsubscribe](#unsubscribe-1)
54
+ - [Copyright & License](#copyright--license)
55
+
9
56
  ### Sample
10
57
 
11
58
  See [slack-ruby/slack-ruby-bot-server-stripe-sample](https://github.com/slack-ruby/slack-ruby-bot-server-stripe-sample) for a working sample.
@@ -42,7 +89,7 @@ Define additional fields on your database.
42
89
 
43
90
  ##### Mongoid
44
91
 
45
- Additional fields from [models/mongoid.rb](lib/slack-ruby-bot-server/stripe/models/mongoid.rb) are automatically included.
92
+ Additional fields from [models/mongoid.rb](lib/slack-ruby-bot-server-stripe/models/mongoid.rb) are automatically included.
46
93
 
47
94
  ##### ActiveRecord
48
95
 
@@ -100,32 +147,7 @@ end
100
147
 
101
148
  #### Add Trial Link
102
149
 
103
- Your bot's help command should display trial text and subscription link. This is typically done in `lib/commands/help.rb`.
104
-
105
- ```ruby
106
- class Help < SlackRubyBot::Commands::Base
107
- HELP = <<-EOS.freeze
108
- ```
109
- Sample bot.
110
-
111
- General
112
- -------
113
-
114
- help - get this helpful message
115
-
116
- ```
117
- EOS
118
-
119
- def self.call(client, data, _match)
120
- client.say(channel: data.channel, text: [
121
- HELP,
122
- client.owner.reload.subscribed? ? nil : client.owner.trial_text
123
- ].compact.join("\n"))
124
-
125
- client.say(channel: data.channel, gif: 'help')
126
- end
127
- end
128
- ```
150
+ Your bot's help command should display trial text and a subscription link using `team.trial_text`.
129
151
 
130
152
  ### Attributes
131
153
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler/gem_tasks'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Api
3
5
  module Endpoints
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Api
3
5
  module Presenters
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Api
3
5
  module Presenters
4
6
  module TeamPresenter
5
- property :subscribed, type: Boolean, desc: 'Team is a paid subscriber.'
7
+ property :subscribed, type: ::Grape::API::Boolean, desc: 'Team is a paid subscriber.'
6
8
  property :subscribed_at, type: DateTime, desc: 'Date/time when a subscription was purchased.'
7
9
  end
8
10
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'presenters/root_presenter'
2
4
  require_relative 'presenters/team_presenter'
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'api/presenters'
2
4
  require_relative 'api/endpoints'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
5
  module Api
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'endpoints/subscriptions_endpoint'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'api/endpoints'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
5
  module Commands
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
5
  module Commands
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'commands/subscription'
2
4
  require_relative 'commands/unsubscribe'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
5
  module Config
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
5
  module Errors
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SlackRubyBotServer::Config.service_class.instance.on :starting do |team|
2
4
  begin
3
5
  team.check_stripe!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'methods'
2
4
 
3
5
  module SlackRubyBotServer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
5
  module Models
@@ -35,13 +37,17 @@ module SlackRubyBotServer
35
37
 
36
38
  def subscription_text(options = { include_admin_info: false })
37
39
  subscription_text = []
38
- if active_stripe_subscription?
40
+ if stripe_customer
39
41
  subscription_text << stripe_customer_text
40
- subscription_text.concat(stripe_customer_subscriptions_info)
41
- if options[:include_admin_info]
42
- subscription_text.concat(stripe_customer_invoices_info)
43
- subscription_text.concat(stripe_customer_sources_info)
44
- subscription_text << update_cc_text
42
+ if stripe_subscriptions&.any?
43
+ subscription_text.concat(stripe_customer_subscriptions_info)
44
+ if options[:include_admin_info]
45
+ subscription_text.concat(stripe_customer_invoices_info)
46
+ subscription_text.concat(stripe_customer_sources_info)
47
+ subscription_text << update_cc_text
48
+ end
49
+ else
50
+ subscription_text << 'No active subscriptions.'
45
51
  end
46
52
  elsif subscribed && subscribed_at
47
53
  subscription_text << subscriber_text
@@ -117,6 +123,12 @@ module SlackRubyBotServer
117
123
  end
118
124
  end
119
125
 
126
+ def stripe_subscriptions
127
+ return unless stripe_customer
128
+
129
+ stripe_customer.subscriptions
130
+ end
131
+
120
132
  def trial_ends_at
121
133
  raise Errors::AlreadySubscribedError if subscribed?
122
134
 
@@ -176,12 +188,16 @@ module SlackRubyBotServer
176
188
  raise Errors::NotSubscribedError unless subscribed?
177
189
  raise Errors::MissingStripeCustomerError unless stripe_customer
178
190
 
179
- stripe_customer.subscriptions.each do |subscription|
180
- case subscription.status
181
- when 'past_due'
182
- subscription_past_due!
183
- when 'canceled', 'unpaid'
184
- subscription_expired!
191
+ if stripe_customer.subscriptions.none?
192
+ subscription_expired!
193
+ else
194
+ stripe_customer.subscriptions.each do |subscription|
195
+ case subscription.status
196
+ when 'past_due'
197
+ subscription_past_due!
198
+ when 'canceled', 'unpaid'
199
+ subscription_expired!
200
+ end
185
201
  end
186
202
  end
187
203
  end
@@ -268,8 +284,13 @@ module SlackRubyBotServer
268
284
  def stripe_customer_subscriptions_info
269
285
  stripe_customer.subscriptions.map do |subscription|
270
286
  amount = ActiveSupport::NumberHelper.number_to_currency(subscription.plan.amount.to_f / 100)
271
- current_period_end = Time.at(subscription.current_period_end).strftime('%B %d, %Y')
272
- "Subscribed to #{subscription.plan.name} (#{amount}), will#{subscription.cancel_at_period_end ? ' not' : ''} auto-renew on #{current_period_end}."
287
+ if subscription.status == 'active'
288
+ current_period_end = Time.at(subscription.current_period_end).strftime('%B %d, %Y')
289
+ "Subscribed to #{subscription.plan.name} (#{amount}), will#{subscription.cancel_at_period_end ? ' not' : ''} auto-renew on #{current_period_end}."
290
+ else
291
+ subscription_created_at = Time.at(subscription.created).strftime('%B %d, %Y')
292
+ "#{subscription.status.titleize} subscription created #{subscription_created_at} to #{subscription.plan.name} (#{amount})."
293
+ end
273
294
  end
274
295
  end
275
296
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'methods'
2
4
 
3
5
  module SlackRubyBotServer
@@ -9,7 +11,7 @@ module SlackRubyBotServer
9
11
 
10
12
  included do
11
13
  field :stripe_customer_id, type: String
12
- field :subscribed, type: Boolean, default: false
14
+ field :subscribed, type: ::Mongoid::Boolean, default: false
13
15
  field :subscribed_at, type: DateTime
14
16
  field :subscription_expired_at, type: DateTime
15
17
  field :trial_informed_at, type: DateTime
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'models/methods'
2
4
  require_relative "models/#{::SlackRubyBotServer::Config.database_adapter}.rb"
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SlackRubyBotServer
2
4
  module Stripe
3
- VERSION = '0.1.0'.freeze
5
+ VERSION = '0.2.0'
4
6
  end
5
7
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'stripe'
2
4
 
3
- require 'slack-ruby-bot-server'
5
+ require 'slack-ruby-bot-server-rtm'
4
6
 
5
7
  require_relative 'slack-ruby-bot-server-stripe/version'
6
8
  require_relative 'slack-ruby-bot-server-stripe/config'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'slack-ruby-bot-server-stripe/version'
@@ -14,6 +16,6 @@ Gem::Specification.new do |spec|
14
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
15
17
  spec.require_paths = ['lib']
16
18
 
17
- spec.add_dependency 'slack-ruby-bot-server', '>= 0.12.0'
19
+ spec.add_dependency 'slack-ruby-bot-server-rtm'
18
20
  spec.add_dependency 'stripe', '~> 1.58.0'
19
21
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot-server-stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: slack-ruby-bot-server
14
+ name: slack-ruby-bot-server-rtm
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.12.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: stripe
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,22 +38,26 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.58.0
41
- description:
41
+ description:
42
42
  email:
43
43
  - dblock@dblock.org
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".github/workflows/danger.yml"
49
+ - ".github/workflows/rubocop.yml"
50
+ - ".github/workflows/test-mongodb.yml"
51
+ - ".github/workflows/test-postgresql.yml"
48
52
  - ".gitignore"
49
53
  - ".rspec"
50
54
  - ".rubocop.yml"
51
55
  - ".rubocop_todo.yml"
52
- - ".travis.yml"
53
56
  - CHANGELOG.md
54
57
  - CONTRIBUTING.md
55
58
  - Dangerfile
56
59
  - Gemfile
60
+ - Gemfile.danger
57
61
  - LICENSE
58
62
  - README.md
59
63
  - RELEASING.md
@@ -85,7 +89,7 @@ files:
85
89
  homepage: https://github.com/slack-ruby/slack-ruby-bot-server-stripe
86
90
  licenses: []
87
91
  metadata: {}
88
- post_install_message:
92
+ post_install_message:
89
93
  rdoc_options: []
90
94
  require_paths:
91
95
  - lib
@@ -100,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
104
  - !ruby/object:Gem::Version
101
105
  version: '0'
102
106
  requirements: []
103
- rubygems_version: 3.0.3
104
- signing_key:
107
+ rubygems_version: 3.1.6
108
+ signing_key:
105
109
  specification_version: 4
106
110
  summary: Stripe extension for slack-ruby-bot-server.
107
111
  test_files: []
data/.travis.yml DELETED
@@ -1,29 +0,0 @@
1
- language: ruby
2
-
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.6.2
8
- script:
9
- - bundle exec danger
10
- - rvm: 2.6.2
11
- env: DATABASE_ADAPTER=activerecord
12
- services:
13
- - postgresql
14
- - xvfb
15
- addons:
16
- firefox: 54.0
17
- - rvm: 2.6.2
18
- env: DATABASE_ADAPTER=mongoid
19
- services:
20
- - mongodb
21
- - xvfb
22
- addons:
23
- firefox: 54.0
24
-
25
- before_install:
26
- - wget https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
27
- - mkdir geckodriver
28
- - tar -xzf geckodriver-v0.18.0-linux64.tar.gz -C geckodriver
29
- - export PATH=$PATH:$PWD/geckodriver