Remove ruby example in favor of third-party wrapper linked in example/README.md.
GitOrigin-RevId: 3cb6176d9b3493fa291c1738e46c14399d10620c
This commit is contained in:
parent
b1347c3226
commit
c26b05ab69
@ -181,7 +181,7 @@ all available `TDLib` [methods](https://core.telegram.org/tdlib/docs/classtd_1_1
|
||||
`TDLib` JSON interface adheres to semantic versioning and versions with the same major version number are binary and backward compatible, but the underlying `TDLib` API can be different for different minor and even patch versions.
|
||||
If you need to support different `TDLib` versions then you can use a value of the `version` option to find exact `TDLib` version and to use appropriate API then.
|
||||
|
||||
See [example/python/tdjson_example.py](https://github.com/tdlib/td/tree/master/example/python/tdjson_example.py) and [example/ruby/example.rb](https://github.com/tdlib/td/tree/master/example/ruby/example.rb) for examples of such usage.
|
||||
See [example/python/tdjson_example.py](https://github.com/tdlib/td/tree/master/example/python/tdjson_example.py) for an example of such usage.
|
||||
|
||||
<a name="license"></a>
|
||||
## License
|
||||
|
@ -170,7 +170,6 @@ See [d-tdlib-service](https://github.com/Lord-Evil/d-tdlib-service) for an examp
|
||||
TDLib can be used from the Ruby programming language through the [JSON](https://github.com/tdlib/td#using-json) interface.
|
||||
|
||||
See [tdlib-ruby](https://github.com/centosadmin/tdlib-ruby) for examples of Ruby bindings and a client for TDLib.
|
||||
See [example/ruby](https://github.com/tdlib/td/tree/master/example/ruby) for an example of logging in to Telegram using TDLib and `tdlib-ruby` gem.
|
||||
|
||||
<a name="clojure"></a>
|
||||
## Using TDLib in Clojure projects
|
||||
|
@ -1,3 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'tdlib-ruby'
|
@ -1,17 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
concurrent-ruby (1.0.5)
|
||||
dry-configurable (0.7.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
tdlib-ruby (0.2.0)
|
||||
dry-configurable (~> 0.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
tdlib-ruby
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
@ -1,61 +0,0 @@
|
||||
require 'tdlib-ruby'
|
||||
|
||||
TD.configure do |config|
|
||||
config.lib_path = 'path/to/dir_containing_lobtdjson'
|
||||
|
||||
# You should obtain your own api_id and api_hash from https://my.telegram.org/apps
|
||||
config.client.api_id = 12345
|
||||
config.client.api_hash = '1234567890abcdefghigklmnopqrstuv'
|
||||
end
|
||||
|
||||
TD::Api.set_log_verbosity_level(1)
|
||||
|
||||
client = TD::Client.new
|
||||
|
||||
begin
|
||||
state = nil
|
||||
|
||||
client.on('updateAuthorizationState') do |update|
|
||||
next unless update.dig('authorization_state', '@type') == 'authorizationStateWaitPhoneNumber'
|
||||
state = :wait_phone
|
||||
end
|
||||
|
||||
client.on('updateAuthorizationState') do |update|
|
||||
next unless update.dig('authorization_state', '@type') == 'authorizationStateWaitCode'
|
||||
state = :wait_code
|
||||
end
|
||||
|
||||
client.on('updateAuthorizationState') do |update|
|
||||
next unless update.dig('authorization_state', '@type') == 'authorizationStateReady'
|
||||
state = :ready
|
||||
end
|
||||
|
||||
loop do
|
||||
case state
|
||||
when :wait_phone
|
||||
p 'Please, enter your phone number:'
|
||||
phone = STDIN.gets.strip
|
||||
params = {
|
||||
'@type' => 'setAuthenticationPhoneNumber',
|
||||
'phone_number' => phone
|
||||
}
|
||||
client.broadcast_and_receive(params)
|
||||
when :wait_code
|
||||
p 'Please, enter code from SMS:'
|
||||
code = STDIN.gets.strip
|
||||
params = {
|
||||
'@type' => 'checkAuthenticationCode',
|
||||
'code' => code
|
||||
}
|
||||
client.broadcast_and_receive(params)
|
||||
when :ready
|
||||
@me = client.broadcast_and_receive('@type' => 'getMe')
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
ensure
|
||||
client.close
|
||||
end
|
||||
|
||||
p @me
|
Reference in New Issue
Block a user