Class: Winstreaks
- Inherits:
-
Object
- Object
- Winstreaks
- Defined in:
- lib/streaks.rb
Instance Method Summary collapse
-
#initialize(game) ⇒ Winstreaks
constructor
A new instance of Winstreaks.
- #leaderboard(*args) ⇒ Object
- #profile(uuid) ⇒ Object
Constructor Details
#initialize(game) ⇒ Winstreaks
Returns a new instance of Winstreaks.
6 7 8 |
# File 'lib/streaks.rb', line 6 def initialize(game) @game = game end |
Instance Method Details
#leaderboard(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/streaks.rb', line 10 def leaderboard(*args) if args.length == 2 url = "https://api.roccodev.pw/#{@game}/winstreaks/leaderboard?from=#{args[0]}&to=#{args[1]}" else url = "https://api.roccodev.pw/#{@game}/winstreaks/leaderboard" end uri = URI(url) res = Net::HTTP.get(uri) return JSON.parse(res) end |
#profile(uuid) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/streaks.rb', line 21 def profile(uuid) url = "https://api.roccodev.pw/#{@game}/winstreaks/profile/#{uuid}" uri = URI(url) res = Net::HTTP.get(uri) return JSON.parse(res) end |