Module: Binance::Client::REST::UserData_API
- Defined in:
- lib/binance/client/rest/user_data_api.rb
Overview
Public: A Module containing all of the User Data API endpoints
Class Method Summary collapse
-
.extended(base) ⇒ Object
Internal: Create Lambda that returns a new Faraday client instance and add it to the REST class instance variable @api.
Instance Method Summary collapse
-
#close_stream(options) ⇒ Object
Public: Close the User Data stream associated with the listen key.
-
#keep_stream_alive(options) ⇒ Object
Public: Ping the server to keep User Data stream alive.
-
#listen_key ⇒ Object
Public: Retrieve the listen key for the given api key.
Class Method Details
.extended(base) ⇒ Object
Internal: Create Lambda that returns a new Faraday client instance and add it to the REST class instance variable @api. This is called while a new instance of the REST class is created.
base - The base class that is being extended into.
15 16 17 18 19 20 21 22 23 |
# File 'lib/binance/client/rest/user_data_api.rb', line 15 def self.extended(base) REST.api[:user_data] = lambda do Faraday.new(url: "#{BASE_URL}/api") do |conn| conn.response :json, content_type: /\bjson$/ conn.headers['X-MBX-APIKEY'] = base.api_key conn.adapter base.adapter end end end |
Instance Method Details
#close_stream(options) ⇒ Object
Public: Close the User Data stream associated with the listen key
options - The Hash which hosts various REST query params.
:listen_key - The String of which stream to close
Returns a Hash with the request response
48 49 50 |
# File 'lib/binance/client/rest/user_data_api.rb', line 48 def close_stream() request :user_data, :delete, 'userDataStream', end |
#keep_stream_alive(options) ⇒ Object
Public: Ping the server to keep User Data stream alive
options - The Hash which hosts various REST query params.
:listen_key - The String of which stream to keep alive
Returns a Hash with the request response
38 39 40 |
# File 'lib/binance/client/rest/user_data_api.rb', line 38 def keep_stream_alive() request :user_data, :put, 'userDataStream', end |
#listen_key ⇒ Object
Public: Retrieve the listen key for the given api key
Returns a Hash with the request response
28 29 30 |
# File 'lib/binance/client/rest/user_data_api.rb', line 28 def listen_key request :user_data, :post, 'userDataStream' end |