Method: HypixelAPI#fetch

Defined in:
lib/hypixel-ruby.rb

#fetch(url) ⇒ Object

Parses url to Rubyfiy the request, internal so you won’t need to use it for much.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hypixel-ruby.rb', line 12

def fetch(url)
  if @min != Time.now.min
    @min = Time.now.min
    @requests = 0
  end
  if @requests < 120
    @requests += 1
    source = (open URI(url)).read
    x = JSON.parse(source, :symbolize_names => true)
    x.extend Hashie::Extensions::DeepFind
    return x
  end
end