class TelegramBot::ResponseError

Attributes

response[R]

Public Class Methods

new(res) click to toggle source
# File lib/telegram_bot/response_error.rb, line 5
def initialize(res)
  @response = res
end

Public Instance Methods

data() click to toggle source
# File lib/telegram_bot/response_error.rb, line 9
def data
  @data ||= begin
    JSON.parse(response.body)
  rescue JSON::ParserError
    { error_code: response.status, error_message: response.reason_phrase }
  end
end