File tree Expand file tree Collapse file tree 10 files changed +57
-10
lines changed
Expand file tree Collapse file tree 10 files changed +57
-10
lines changed Original file line number Diff line number Diff line change 1+ SLACK_CLIENT_ID =
2+ SLACK_CLIENT_SECRET =
3+ SLACK_VERIFICATION_TOKEN =
4+ SLACK_OAUTH_SCOPE =
5+ STRIPE_API_KEY =
6+ STRIPE_API_PUBLISHABLE_KEY =
7+ STRIPE_API_SUBSCRIPTION_PLAN_ID =
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ gem 'newrelic-slack-ruby-bot'
1010gem 'slack-ruby-bot-server' , github : 'slack-ruby/slack-ruby-bot-server'
1111gem 'slack-ruby-bot-server-stripe' , github : 'slack-ruby/slack-ruby-bot-server-stripe'
1212gem 'unicorn'
13+ gem 'irb'
1314
1415group :test do
1516 gem 'capybara'
Original file line number Diff line number Diff line change 11GIT
22 remote: git://github.com/slack-ruby/slack-ruby-bot-server-stripe.git
3- revision: 72a04b49cc2911105e90abf079274307a1ce852c
3+ revision: 3c7e0de6c13ffab2a775a05a1c80e5847e12924e
44 specs:
55 slack-ruby-bot-server-stripe (0.1.0 )
66 slack-ruby-bot-server (>= 0.12.0 )
116116 domain_name (~> 0.5 )
117117 i18n (1.8.2 )
118118 concurrent-ruby (~> 1.0 )
119+ io-console (0.5.6 )
120+ irb (1.2.3 )
121+ reline (>= 0.0.1 )
119122 kaminari-core (1.2.0 )
120123 kaminari-grape (1.0.1 )
121124 grape
167170 raindrops (0.19.1 )
168171 rake (13.0.1 )
169172 regexp_parser (1.7.0 )
173+ reline (0.1.4 )
174+ io-console (~> 0.5 )
170175 representable (3.0.4 )
171176 declarative (< 0.1.0 )
172177 declarative-option (< 0.2.0 )
@@ -240,6 +245,7 @@ DEPENDENCIES
240245 database_cleaner
241246 fabrication
242247 faker
248+ irb
243249 mongoid
244250 mongoid-scroll
245251 newrelic-slack-ruby-bot
Original file line number Diff line number Diff line change @@ -7,6 +7,22 @@ Slack Ruby Bot Server Stripe Sample
77
88A sample app based on [ slack-ruby-bot-server-sample] ( https://github.com/slack-ruby/slack-ruby-bot-server-sample ) that integrates with [ Stripe] ( https://stripe.com ) using [ slack-ruby-bot-server-stripe] ( https://github.com/slack-ruby/slack-ruby-bot-server-stripe ) .
99
10+ ### Running the Sample
11+
12+ Create ` .env ` file with the following settings.
13+
14+ ```
15+ SLACK_CLIENT_ID=...
16+ SLACK_CLIENT_SECRET=...
17+ SLACK_VERIFICATION_TOKEN=...
18+ SLACK_OAUTH_SCOPE=bot,commands
19+ STRIPE_API_KEY=...
20+ STRIPE_API_PUBLISHABLE_KEY=...
21+ STRIPE_SUBSCRIPTION_PLAN_ID=...
22+ ```
23+
24+ Run ` bundle install ` and ` foreman start ` .
25+
1026### Copyright & License
1127
1228Copyright [ Daniel Doubrovkine] ( http://code.dblock.org ) , 2020
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
2+ ENV [ 'RACK_ENV' ] ||= 'development'
3+
4+ Bundler . require :default
25
36Dir [ File . expand_path ( 'config/initializers' , __dir__ ) + '/**/*.rb' ] . sort . each do |file |
47 require file
58end
69
10+ Mongoid . load! ( File . expand_path ( 'config/mongoid.yml' , __dir__ ) , ENV [ 'RACK_ENV' ] )
11+
712require_relative 'lib/models'
813require_relative 'lib/commands'
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- ENV [ 'RACK_ENV' ] ||= 'development'
4-
5- Bundler . require :default
6-
73require_relative 'app'
84
9- Mongoid . load! ( File . expand_path ( 'config/mongoid.yml' , __dir__ ) , ENV [ 'RACK_ENV' ] )
10-
115NewRelic ::Agent . manual_start
126
137SlackRubyBotServer ::App . instance . prepare!
Original file line number Diff line number Diff line change 33SlackRubyBotServer ::Stripe . configure do |config |
44 config . stripe_api_key ||= ENV [ 'STRIPE_API_KEY' ]
55 config . stripe_api_publishable_key ||= ENV [ 'STRIPE_API_PUBLISHABLE_KEY' ]
6- config . subscription_plan_id ||= 'prod_HAevgsGOq8MCZZ '
6+ config . subscription_plan_id ||= 'plan_HAevT5j3xmP7a6 '
77 config . subscription_plan_amount = 0
88 config . trial_duration = 2 . weeks
99 config . root_url = ENV [ 'URL' ] || 'http://localhost:5000'
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ class Help < SlackRubyBot::Commands::Base
55 ```
66 Sample bot that uses slack-ruby-bot-server-stripe.
77
8- General
9- -------
8+ Commands
9+ --------
1010
1111 help - get this helpful message
12+ subscription - get subscription info
13+ unsubscribe - unsubscribe
1214
1315 ```
1416 EOS
Original file line number Diff line number Diff line change @@ -23,6 +23,19 @@ class Team
2323
2424 private
2525
26+ def slack_client
27+ @slack_client ||= Slack ::Web ::Client . new ( token : token )
28+ end
29+
30+ def slack_channels
31+ slack_client . channels_list (
32+ exclude_archived : true ,
33+ exclude_members : true
34+ ) [ 'channels' ] . select do |channel |
35+ channel [ 'is_member' ]
36+ end
37+ end
38+
2639 def inform! ( message )
2740 slack_channels . each do |channel |
2841 message_with_channel = message . merge ( channel : channel [ 'id' ] , as_user : true )
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ exec bundle exec irb -I . -r " app"
You can’t perform that action at this time.
0 commit comments