class TelegramBot::ApiResponse

Attributes

body[R]
ok[R]
ok?[R]
result[R]

Public Class Methods

new(res) click to toggle source
# File lib/telegram_bot/api_response.rb, line 5
def initialize(res)
  @body = res.body
  if res.status == 200
    data = JSON.parse(body)
    @ok = data["ok"]
    @result = data["result"]
  else
    @ok = false
    error = ResponseError.new(res)
    fail error, "An error has occurred: #{error.data}", caller
  end
end