зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-07 19:35:52 +03:00
Moved Botan helpers to its namespace
Этот коммит содержится в:
@@ -353,11 +353,11 @@ or just add `botan` key in `secrets.yml`:
|
|||||||
Access to Botan client with `bot.botan`.
|
Access to Botan client with `bot.botan`.
|
||||||
Use `bot.botan.track(event, uid, payload)` to track events.
|
Use `bot.botan.track(event, uid, payload)` to track events.
|
||||||
|
|
||||||
There are some helpers for controllers in `Telegram::Bot::UpdatesController::Botan`:
|
There are some helpers for controllers in `Telegram::Bot::Botan::ControllerHelpers`:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
class Telegram::WebhookController < Telegram::Bot::UpdatesController
|
class Telegram::WebhookController < Telegram::Bot::UpdatesController
|
||||||
include Telegram::Bot::UpdatesController::Botan
|
include Telegram::Bot::Botan::ControllerHelpers
|
||||||
|
|
||||||
# This will track with event: action_name & data: payload
|
# This will track with event: action_name & data: payload
|
||||||
before_action :botan_track_action
|
before_action :botan_track_action
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module Telegram
|
|||||||
class Botan
|
class Botan
|
||||||
TRACK_URI = 'https://api.botan.io/track'.freeze
|
TRACK_URI = 'https://api.botan.io/track'.freeze
|
||||||
|
|
||||||
|
autoload :ControllerHelpers, 'telegram/bot/botan/controller_helpers'
|
||||||
class Error < Bot::Error; end
|
class Error < Bot::Error; end
|
||||||
|
|
||||||
include DebugClient
|
include DebugClient
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
module Telegram
|
module Telegram
|
||||||
module Bot
|
module Bot
|
||||||
class UpdatesController
|
class Botan
|
||||||
# Helpers for botan.io metrics.
|
# Helpers for botan.io metrics.
|
||||||
module Botan
|
module ControllerHelpers
|
||||||
class MissingFrom < Error; end
|
class MissingFrom < Error; end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@@ -59,7 +59,6 @@ module Telegram
|
|||||||
require 'telegram/bot/updates_controller/reply_helpers'
|
require 'telegram/bot/updates_controller/reply_helpers'
|
||||||
autoload :CallbackQueyContext, 'telegram/bot/updates_controller/callback_query_context'
|
autoload :CallbackQueyContext, 'telegram/bot/updates_controller/callback_query_context'
|
||||||
autoload :MessageContext, 'telegram/bot/updates_controller/message_context'
|
autoload :MessageContext, 'telegram/bot/updates_controller/message_context'
|
||||||
autoload :Botan, 'telegram/bot/updates_controller/botan'
|
|
||||||
|
|
||||||
include AbstractController::Callbacks
|
include AbstractController::Callbacks
|
||||||
# Redefine callbacks with default terminator.
|
# Redefine callbacks with default terminator.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
RSpec.describe Telegram::Bot::UpdatesController::Botan do
|
RSpec.describe Telegram::Bot::Botan::ControllerHelpers do
|
||||||
include_context 'telegram/bot/updates_controller'
|
include_context 'telegram/bot/updates_controller'
|
||||||
let(:controller_class) do
|
let(:controller_class) do
|
||||||
described_class = self.described_class
|
described_class = self.described_class
|
||||||
Ссылка в новой задаче
Block a user