lib/telegram/bot/client.rb in telegram-bot-0.4.2 vs lib/telegram/bot/client.rb in telegram-bot-0.5.0
- old
+ new
@@ -17,10 +17,13 @@
when self then input
when Array then input.map(&method(__callee__))
when Hash then
input = input.stringify_keys
new input['token'], input['username']
+ when Symbol
+ Telegram.bots[input] or
+ raise "Bot #{input} not configured, check Telegram.bots_config."
else
new(input)
end
end
@@ -102,10 +105,10 @@
def http_request(uri, body)
client.post(uri, body)
end
def inspect
- "#<Telegram::Bot::Client##{object_id}(#{@username})>"
+ "#<#{self.class.name}##{object_id}(#{@username})>"
end
end
end
end