Class: Osu::API::Beatmap

Inherits:
Object
  • Object
show all
Includes:
GetRequest
Defined in:
lib/osu/api.rb

Instance Attribute Summary

Attributes included from GetRequest

#endpoint, #params

Instance Method Summary collapse

Methods included from GetRequest

#execute, #url

Constructor Details

#initialize(id: nil, set: nil, author: nil, mode: nil, limit: nil) ⇒ Beatmap

NOTE: You can make a query with ID, OR author and mode, not all three.

If you specify all three, ID will be ignored by the API

32
33
34
35
36
37
38
39
40
41
42
# File 'lib/osu/api.rb', line 32

def initialize(id: nil, set: nil, author: nil, mode: nil, limit: nil)
  @endpoint = 'get_beatmaps'

  @params = {}

  @params.merge! API.beatmap(id) if id
  @params.merge! API.beatmap_set(set) if set
  @params.merge! API.user(author) if author
  @params.merge! API.mode(mode) if mode
  @params.merge! API.limit(limit) if limit
end