Class: Binance::Session

Inherits:
Object
  • Object
show all
Includes:
Utils::Faraday::Middleware
Defined in:
lib/binance/session.rb

Overview

Session has the http request connection

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Session

Returns a new instance of Session.



12
13
14
15
16
17
18
19
# File 'lib/binance/session.rb', line 12

def initialize(options = {})
  @base_url = options[:base_url] || 'https://api.binance.com'
  @auth = Authentication.new(options[:key], options[:secret], options[:private_key], options[:private_key_pass_phrase])
  @logger = options[:logger]
  @show_weight_usage = options[:show_weight_usage] || false
  @show_header = options[:show_header] || false
  @timeout = options[:timeout]
end

Instance Method Details

#limit_request(method: :get, path: '/', params: {}) ⇒ Object



25
26
27
# File 'lib/binance/session.rb', line 25

def limit_request(method: :get, path: '/', params: {})
  process_request(limit_conn, method, path, params)
end

#public_request(path: '/', params: {}) ⇒ Object



21
22
23
# File 'lib/binance/session.rb', line 21

def public_request(path: '/', params: {})
  process_request(public_conn, :get, path, params)
end

#sign_request(method, path, params: {}) ⇒ Object



29
30
31
# File 'lib/binance/session.rb', line 29

def sign_request(method, path, params: {})
  process_request(signed_conn, method, path, params)
end