Class: KucoinRuby::Util
- Inherits:
-
Object
- Object
- KucoinRuby::Util
- Defined in:
- lib/kucoin_ruby/util.rb
Class Method Summary collapse
- .build_message(endpoint, nonce, query_string = '') ⇒ Object
- .nonce ⇒ Object
- .sign(string) ⇒ Object
- .sign_message(endpoint, query_string = nil) ⇒ Object
Class Method Details
.build_message(endpoint, nonce, query_string = '') ⇒ Object
7 8 9 |
# File 'lib/kucoin_ruby/util.rb', line 7 def self.(endpoint, nonce, query_string = '') "#{endpoint}/#{nonce}/#{query_string}" end |
.nonce ⇒ Object
3 4 5 |
# File 'lib/kucoin_ruby/util.rb', line 3 def self.nonce (Time.now.to_f * 1000).to_i.to_s end |
.sign(string) ⇒ Object
11 12 13 14 |
# File 'lib/kucoin_ruby/util.rb', line 11 def self.sign(string) base = Base64.strict_encode64(string) sign_hmac(base) end |
.sign_message(endpoint, query_string = nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/kucoin_ruby/util.rb', line 16 def self.(endpoint, query_string = nil) nc = nonce query_string = compose_query_string(query_string) [nc, sign((endpoint, nc, query_string))] end |