Class: BotAPI::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram_bot_builder/bot_api.rb

Instance Method Summary collapse

Constructor Details

#initializeAuth



84
85
86
# File 'lib/telegram_bot_builder/bot_api.rb', line 84

def initialize
  #return auth
end

Instance Method Details

#authObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/telegram_bot_builder/bot_api.rb', line 88

def auth
  method = 'getMe'

  uri = URI.parse(URLBUIDER.build(method))
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  result = http.get(uri.request_uri)

  if result.code == "200"
    object = BotAPI.parse(method, result.body)

    return object
  end
end