module FantasticRobot
Constants
- VERSION
Attributes
configuration[RW]
connection[R]
Public Class Methods
configure() { |configuration| ... }
click to toggle source
# File lib/fantastic_robot.rb, line 28 def self.configure self.configuration ||= Configuration.new yield(configuration) end
initialize!()
click to toggle source
# File lib/fantastic_robot.rb, line 15 def self.initialize! raise ArgumentError, "API Key is needed." if (self.configuration.api_key.blank?) if (self.configuration.delivery_method == :webhook) unless (self.configuration.callback_url.blank?) # Register the webhook against Telegram register_webhook else raise ArgumentError, 'Webhook method requires a callback URL' end end end
register_webhook()
click to toggle source
Function to register the configured webhook against the Telegram API.
# File lib/fantastic_robot.rb, line 44 def self.register_webhook FantasticRobot::Request::SetWebhook.new(url: self.configuration.callback_url).send_request end
response_json(request)
click to toggle source
Method to respond to an update with a request. It can manage a Request
object or a hash.
# File lib/fantastic_robot.rb, line 52 def self.response_json(request) return nil unless request.is_a?(Hash) || request.is_a?(FantasticRobot::Request::Base) request.to_h end