Sha256: baba1bed0f2db6d68dda2bde70a2b7c1a0d73cebb2f7d60b00196472ad25089a
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
module Telegram module Bot module Exceptions class ResponseError < Base attr_reader :response def initialize(response) @response = response end def to_s super + format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', ')) end def error_code data[:error_code] || data["error_code"] end private def data @data ||= begin JSON.parse(response.body) rescue JSON::ParserError { error_code: response.code, uri: response.request.last_uri.to_s } end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
telegram-bot-ruby-0.3.11 | lib/telegram/bot/exceptions/response_error.rb |