lib/codewars_api/user.rb in codewars_api-0.2.1 vs lib/codewars_api/user.rb in codewars_api-0.3.0
- old
+ new
@@ -3,9 +3,10 @@
include Common
def initialize(id_or_username)
fail 'Username or id is not set' unless id_or_username
@response = RequestHelper.get("#{CodewarsApi::API_URL}/users/#{id_or_username}")
+ fail @response.message if @response.code == 500
end
def username
@response.to_h['username']
end