lib/triviacrack/api/user.rb in triviacrack-0.5.1 vs lib/triviacrack/api/user.rb in triviacrack-0.6.0

- old
+ new

@@ -24,14 +24,12 @@ # Trim the @ character from the start of the username if username.start_with? "@" username = username[1..-1] end - response = get "/api/search?username=#{username}" + body = get "/api/search?username=#{username}" - body = response.body - user_id = false body["list"].each do |user| if user["username"] == username user_id = user["id"] break @@ -46,10 +44,10 @@ # Returns a TriviaCrack::User representing the current user. # Raises TriviaCrack::Errors::RequestError if the request fails def get_user response = get "/api/users/#{@session.user_id}" - TriviaCrack::Parsers::UserParser.parse response.body + TriviaCrack::Parsers::UserParser.parse response end end end end