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



54
55
56
57
58
59
60
61
62
63
# File 'lib/bittrex-enterprise/api_helpers.rb', line 54

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
22
23
24
25
26
27
28
29
30
# 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
    puts "CALL:"
    puts bittrex_uri
    puts api_group
    puts params
    response = HTTParty.get(bittrex_uri + api_group, query: params)
    puts "TEST:"
    puts response
    res_hash response
  rescue => e
    puts "TEST:"
    puts response
    res_hash e.response
  end
end

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



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

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



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

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