Class: GrubY::TDLib::TdJson
- Inherits:
-
Object
- Object
- GrubY::TDLib::TdJson
- Defined in:
- lib/gruubY/tdlib/tdjson.rb
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #create_client_id ⇒ Object
- #destroy(client_id) ⇒ Object
- #execute(client_id, request) ⇒ Object
-
#initialize(lib_path: nil, verbosity: 1) ⇒ TdJson
constructor
A new instance of TdJson.
- #receive(client_id, timeout:) ⇒ Object
- #send(client_id, request) ⇒ Object
Constructor Details
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/gruubY/tdlib/tdjson.rb', line 7 def version @version end |
Instance Method Details
#create_client_id ⇒ Object
15 16 17 |
# File 'lib/gruubY/tdlib/tdjson.rb', line 15 def create_client_id Native.td_json_client_create end |
#destroy(client_id) ⇒ Object
33 34 35 |
# File 'lib/gruubY/tdlib/tdjson.rb', line 33 def destroy(client_id) Native.td_json_client_destroy(client_id) end |
#execute(client_id, request) ⇒ Object
28 29 30 31 |
# File 'lib/gruubY/tdlib/tdjson.rb', line 28 def execute(client_id, request) raw = Native.td_json_client_execute(client_id, JSON.generate(request)) raw ? JSON.parse(raw) : nil end |
#receive(client_id, timeout:) ⇒ Object
23 24 25 26 |
# File 'lib/gruubY/tdlib/tdjson.rb', line 23 def receive(client_id, timeout:) raw = Native.td_json_client_receive(client_id, timeout.to_f) raw ? JSON.parse(raw) : nil end |
#send(client_id, request) ⇒ Object
19 20 21 |
# File 'lib/gruubY/tdlib/tdjson.rb', line 19 def send(client_id, request) Native.td_json_client_send(client_id, JSON.generate(request)) end |