class CodewarsApi::User
Public Class Methods
new(id_or_username)
click to toggle source
# File lib/codewars_api/user.rb, line 5 def initialize(id_or_username) raise 'Username or id is not set' unless id_or_username @response = RequestHelper.get("#{CodewarsApi::API_URL}/users/#{id_or_username}") ResponseChecker.check_errors(@response) end
Public Instance Methods
clan()
click to toggle source
# File lib/codewars_api/user.rb, line 23 def clan @response.to_h['clan'] end
honor()
click to toggle source
# File lib/codewars_api/user.rb, line 19 def honor @response.to_h['honor'] end
katas_completed()
click to toggle source
# File lib/codewars_api/user.rb, line 47 def katas_completed @response.to_h['codeChallenges'].andand['totalCompleted'] end
leaderboard_position()
click to toggle source
# File lib/codewars_api/user.rb, line 27 def leaderboard_position @response.to_h['leaderboardPosition'] end
name()
click to toggle source
# File lib/codewars_api/user.rb, line 15 def name @response.to_h['name'] end
rank_languages()
click to toggle source
# File lib/codewars_api/user.rb, line 39 def rank_languages @response.to_h['ranks'].andand['languages'] end
rank_overall()
click to toggle source
# File lib/codewars_api/user.rb, line 35 def rank_overall @response.to_h['ranks'].andand['overall'] end
skills()
click to toggle source
# File lib/codewars_api/user.rb, line 31 def skills @response.to_h['skills'] end
username()
click to toggle source
# File lib/codewars_api/user.rb, line 11 def username @response.to_h['username'] end