hypixel-ruby 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/hypixel-ruby.rb +67 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d6a5c37f9c63c528d5348682e7795d7e4f16a320
|
4
|
+
data.tar.gz: ee7abac1e63b907cc5cc23207548c3792df8b872
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5fda54ce0e69d95038b56e77acd0e357a859101d8ad4c6b77c66df61346a968a7b36bd81b8eb77a65bea7fe742d271c89d30e4870c00a16c18f56795d6b55af7
|
7
|
+
data.tar.gz: 2cb07d34274996b7c3a20e7fd7983fe84cbeba02162b7f91f5cf64a2096d8850fc817c894ec22cbfe898100ad7660e688aaddbaa5725bdac31c4ecf1732a053b
|
data/lib/hypixel-ruby.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class HypixelAPI
|
5
|
+
|
6
|
+
def fetch(url)
|
7
|
+
source = (open URI(url)).read
|
8
|
+
return JSON.parse(source, :symbolize_names => true)
|
9
|
+
end
|
10
|
+
def initialize(key)
|
11
|
+
@key = key
|
12
|
+
end
|
13
|
+
def url(type, hash)
|
14
|
+
url = "https://api.hypixel.net/"
|
15
|
+
url << type.to_s
|
16
|
+
url << "?key=" + @key
|
17
|
+
hash.each do |a1, a2|
|
18
|
+
url << "&" + a1.to_s + "=" + a2.to_s
|
19
|
+
end
|
20
|
+
return url
|
21
|
+
end
|
22
|
+
|
23
|
+
# ========================================
|
24
|
+
# Main Methods
|
25
|
+
# ========================================
|
26
|
+
#
|
27
|
+
# Refer to hypixel PublicAPI for parms
|
28
|
+
# ex: api.player( :uuid => "<uuid here>" )
|
29
|
+
#
|
30
|
+
|
31
|
+
def boosters(args={})
|
32
|
+
fetch(url(:"boosters", args))
|
33
|
+
end
|
34
|
+
|
35
|
+
def findguild(args={})
|
36
|
+
fetch(url(:"findguild", args))
|
37
|
+
end
|
38
|
+
|
39
|
+
def friends(args={})
|
40
|
+
fetch(url(:"friends", args))
|
41
|
+
end
|
42
|
+
|
43
|
+
def guild(args={})
|
44
|
+
fetch(url(:"guild", args))
|
45
|
+
end
|
46
|
+
|
47
|
+
def key(args={})
|
48
|
+
fetch(url(:"key", args))
|
49
|
+
end
|
50
|
+
|
51
|
+
def leaderboards(args={})
|
52
|
+
fetch(url(:"leaderboards", args))
|
53
|
+
end
|
54
|
+
|
55
|
+
def player(args={})
|
56
|
+
fetch(url(:"player", args))
|
57
|
+
end
|
58
|
+
|
59
|
+
def session(args={})
|
60
|
+
fetch(url(:"session", args))
|
61
|
+
end
|
62
|
+
|
63
|
+
def watchdogstats(args={})
|
64
|
+
fetch(url(:"watchdogstats", args))
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hypixel-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- PenguinOwl
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Coming Soon
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/hypixel-ruby.rb
|
20
|
+
homepage: https://github.com/PenguinOwl/hypixel-rubyed/
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.6.14
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Barebones wrapper for hyixel stats
|
44
|
+
test_files: []
|