Module: ApiHelpers::ClassMethods

Defined in:
lib/bittrex-enterprise/api_helpers.rb

Instance Method Summary collapse

Instance Method Details

#bittrex_uriObject



8
9
10
# File 'lib/bittrex-enterprise/api_helpers.rb', line 8

def bittrex_uri
  'https://api.bittrex.com/v3/'
end

#delete_signed(api_group) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/bittrex-enterprise/api_helpers.rb', line 45

def delete_signed(api_group)
  api_group, params, , headers, url = setup_call(api_group, params, 'DELETE')

  begin
    response = HTTParty.delete(url, {body: params, headers: headers})
    res_hash response
  rescue => e
    res_hash e.response
  end
end

#get(api_group, params = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/bittrex-enterprise/api_helpers.rb', line 12

def get(api_group, params = {})
  params.compact!
  api_group, params,  = setup_params(api_group, params)

  begin
    response = HTTParty.get(bittrex_uri + api_group, query: params)
  rescue => e
    res_hash e.response
  end
end

#get_signed(api_group, params = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/bittrex-enterprise/api_helpers.rb', line 23

def get_signed(api_group, params = {})
  api_group, params, , headers, url = setup_call(api_group, params, 'GET')

  begin
    response = HTTParty.get(url, {query: params, headers: headers})
    res_hash response
  rescue => e
    res_hash e.response
  end
end

#post_signed(api_group, params = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/bittrex-enterprise/api_helpers.rb', line 34

def post_signed(api_group, params = {})
  api_group, params, , headers, url = setup_call(api_group, params, 'POST')

  begin
    response = HTTParty.post(url, {body: params.to_json, headers: headers})
    res_hash response
  rescue => e
    res_hash e.response
  end
end