Module: Fishbans
- Extended by:
- Fishbans
- Includes:
- BlockEngine, PlayerSkins
- Included in:
- Fishbans
- Defined in:
- lib/fishbans.rb,
lib/block_engine.rb,
lib/player_skins.rb
Defined Under Namespace
Modules: BlockEngine, PlayerSkins
Constant Summary collapse
- SERVICES =
[ 'mcbouncer', 'minebans', 'glizer', 'mcblockit', 'mcbans' ]
Instance Method Summary collapse
-
#get_all_bans(username) ⇒ Object
Gets all bans on a user.
-
#get_ban_service(username, service) ⇒ Boolean, Hash<String, String>
Gets all bans for a given service for a user.
-
#get_total_bans(username) ⇒ Integer
Gets the total number of bans that the user has.
-
#get_total_bans_service(username, service) ⇒ Boolean, Integer
Gets the total number of bans by service that the user has.
-
#get_userid(username) ⇒ String
Gets the Minecraft UUID for the user.
-
#get_username_history(username) ⇒ Array<String>
Gets username history for the user.
Methods included from PlayerSkins
#get_player_front, #get_player_head, #get_player_skin
Methods included from BlockEngine
Instance Method Details
#get_all_bans(username) ⇒ Object
Gets all bans on a user.
24 25 26 27 |
# File 'lib/fishbans.rb', line 24 def get_all_bans(username) response = get("http://api.fishbans.com/bans/#{username}") parse_generic_ban_result(response) end |
#get_ban_service(username, service) ⇒ Boolean, Hash<String, String>
Gets all bans for a given service for a user.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fishbans.rb', line 35 def get_ban_service(username, service) service.downcase! if SERVICES.include? service response = get("http://api.fishbans.com/bans/#{username}/#{service}") parse_generic_ban_result(response)[service] else false end end |
#get_total_bans(username) ⇒ Integer
Gets the total number of bans that the user has.
50 51 52 53 |
# File 'lib/fishbans.rb', line 50 def get_total_bans(username) response = get("http://api.fishbans.com/stats/#{username}") response['stats']['totalbans'] end |
#get_total_bans_service(username, service) ⇒ Boolean, Integer
Gets the total number of bans by service that the user has.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/fishbans.rb', line 62 def get_total_bans_service(username, service) service.downcase! if SERVICES.include?(service) # Note that the /service part is not necessary, but it slightly improves # performance of the API. response = get("http://api.fishbans.com/stats/#{username}/#{service}") response['stats']['service'][service] else false end end |
#get_userid(username) ⇒ String
Gets the Minecraft UUID for the user.
79 80 81 82 |
# File 'lib/fishbans.rb', line 79 def get_userid(username) response = get("http://api.fishbans.com/uuid/#{username}") response['uuid'] end |
#get_username_history(username) ⇒ Array<String>
Gets username history for the user.
88 89 90 91 |
# File 'lib/fishbans.rb', line 88 def get_username_history(username) response = get("http://api.fishbans.com/history/#{username}") response['data']['history'] end |