Class: SardonyxRing::App
- Inherits:
-
Object
- Object
- SardonyxRing::App
- Includes:
- DSL
- Defined in:
- lib/sardonyx_ring/app.rb
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize(options = {}) ⇒ App
constructor
A new instance of App.
- #socket_start! ⇒ Object
Methods included from DSL
#action_handlers, #cron_handlers, #event_handlers, included, #message_handlers, #view_handlers
Constructor Details
#initialize(options = {}) ⇒ App
Returns a new instance of App.
7 8 9 10 11 12 |
# File 'lib/sardonyx_ring/app.rb', line 7 def initialize( = {}) @app_token = [:app_token] @bot_token = [:bot_token] @bot_auth = nil @logger = [:logger] || Logger.new($stdout, level: :info) end |
Instance Method Details
#client ⇒ Object
14 15 16 |
# File 'lib/sardonyx_ring/app.rb', line 14 def client @client ||= Slack::Web::Client.new(token: @bot_token) end |
#socket_start! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sardonyx_ring/app.rb', line 18 def socket_start! fetch_bot_auth EM.run do start_cron socket_client = Services::SlackSocketClient.new( token: @app_token, logger: @logger ) socket_client.(&method(:handle_event)) socket_client.connect! end end |