Class: Cryptohopper::Resources::Tournaments

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptohopper/resources/tournaments.rb

Overview

‘client.tournaments` — trading competitions.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Tournaments

Returns a new instance of Tournaments.



7
8
9
# File 'lib/cryptohopper/resources/tournaments.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#activeObject



16
17
18
# File 'lib/cryptohopper/resources/tournaments.rb', line 16

def active
  @client._request("GET", "/tournaments/active")
end

#activity(tournament_id) ⇒ Object



39
40
41
42
# File 'lib/cryptohopper/resources/tournaments.rb', line 39

def activity(tournament_id)
  @client._request("GET", "/tournaments/activity",
                   params: { tournament_id: tournament_id })
end

#get(tournament_id) ⇒ Object



20
21
22
23
# File 'lib/cryptohopper/resources/tournaments.rb', line 20

def get(tournament_id)
  @client._request("GET", "/tournaments/gettournament",
                   params: { tournament_id: tournament_id })
end

#join(tournament_id, data = {}) ⇒ Object



54
55
56
57
58
59
# File 'lib/cryptohopper/resources/tournaments.rb', line 54

def join(tournament_id, data = {})
  @client._request(
    "POST", "/tournaments/join",
    body: { tournament_id: tournament_id }.merge(data)
  )
end

#leaderboard(**params) ⇒ Object



44
45
46
47
# File 'lib/cryptohopper/resources/tournaments.rb', line 44

def leaderboard(**params)
  @client._request("GET", "/tournaments/leaderboard",
                   params: params.empty? ? nil : params)
end

#leave(tournament_id) ⇒ Object



61
62
63
64
# File 'lib/cryptohopper/resources/tournaments.rb', line 61

def leave(tournament_id)
  @client._request("POST", "/tournaments/leave",
                   body: { tournament_id: tournament_id })
end

#list(**params) ⇒ Object



11
12
13
14
# File 'lib/cryptohopper/resources/tournaments.rb', line 11

def list(**params)
  @client._request("GET", "/tournaments/gettournaments",
                   params: params.empty? ? nil : params)
end

#search(query) ⇒ Object



25
26
27
# File 'lib/cryptohopper/resources/tournaments.rb', line 25

def search(query)
  @client._request("GET", "/tournaments/search", params: { q: query })
end

#stats(tournament_id) ⇒ Object



34
35
36
37
# File 'lib/cryptohopper/resources/tournaments.rb', line 34

def stats(tournament_id)
  @client._request("GET", "/tournaments/stats",
                   params: { tournament_id: tournament_id })
end

#tournament_leaderboard(tournament_id) ⇒ Object



49
50
51
52
# File 'lib/cryptohopper/resources/tournaments.rb', line 49

def tournament_leaderboard(tournament_id)
  @client._request("GET", "/tournaments/leaderboard_tournament",
                   params: { tournament_id: tournament_id })
end

#trades(tournament_id) ⇒ Object



29
30
31
32
# File 'lib/cryptohopper/resources/tournaments.rb', line 29

def trades(tournament_id)
  @client._request("GET", "/tournaments/trades",
                   params: { tournament_id: tournament_id })
end