Module: Binance::Utils::Url

Defined in:
lib/binance/utils/url.rb

Overview

Url Utils

Class Method Summary collapse

Class Method Details

.add_param(query, key, value) ⇒ Object



19
20
21
22
23
# File 'lib/binance/utils/url.rb', line 19

def add_param(query, key, value)
  query = (query || '').dup
  query << "&#{key}=#{value}"
  query.delete_prefix('&')
end

.build_query(params) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/binance/utils/url.rb', line 9

def build_query(params)
  params.map do |key, value|
    if value.is_a?(Array)
      value.map { |v| "#{key}=#{v}" }.join('&')
    else
      "#{key}=#{value}"
    end
  end.join('&')
end