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
Instance Method Summary collapse
-
#get_all_bans(username) ⇒ Hash/Nil/String
Gets all bans on a user.
-
#get_ban_service(username, service) ⇒ Hash/Nil/Boolean/String
Gets all bans for a given service for a user.
-
#get_total_bans(username) ⇒ Int/String
Gets the total number of bans that the user has.
-
#get_total_bans_service(username, service) ⇒ Int/Boolean/String
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) ⇒ Hash/Nil/String
Gets all bans on a user.
25 26 27 28 29 30 31 32 |
# File 'lib/fishbans.rb', line 25 def get_all_bans(username) response = get("http://api.fishbans.com/bans/#{username}") if response.is_a?(String) return response else return parse_generic_ban_result(response) end end |
#get_ban_service(username, service) ⇒ Hash/Nil/Boolean/String
Gets all bans for a given service for a user.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fishbans.rb', line 41 def get_ban_service(username, service) service = service.downcase if @services.include? service response = get("http://api.fishbans.com/bans/#{username}/#{service}") if response.is_a?(String) return response else return parse_generic_ban_result(response) end else return false end end |
#get_total_bans(username) ⇒ Int/String
Gets the total number of bans that the user has.
60 61 62 63 64 65 66 67 |
# File 'lib/fishbans.rb', line 60 def get_total_bans(username) response = get("http://api.fishbans.com/stats/#{username}") if response.is_a?(String) return response else return response['stats']['totalbans'] end end |
#get_total_bans_service(username, service) ⇒ Int/Boolean/String
Gets the total number of bans by service that the user has.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/fishbans.rb', line 76 def get_total_bans_service(username, service) 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}") if response.is_a?(String) return response else return response['stats']['service'][service] end else return false end end |
#get_userid(username) ⇒ String
Gets the Minecraft UUID for the user.
94 95 96 97 98 99 100 101 |
# File 'lib/fishbans.rb', line 94 def get_userid(username) response = get("http://api.fishbans.com/uuid/#{username}") if response.is_a?(String) return response else return response['uuid'] end end |
#get_username_history(username) ⇒ Array/String
Gets username history for the user.
107 108 109 110 111 112 113 114 |
# File 'lib/fishbans.rb', line 107 def get_username_history(username) response = get("http://api.fishbans.com/history/#{username}") if response.is_a?(String) return response else return response['data']['history'] end end |