def api_response(resource, optional_arg = nil)
      raise ArgumentError, "You must define a resource to query WaniKani" if resource.nil? || resource.empty?

      begin
        res = client.get("/api/#{@api_version}/user/#{@api_key}/#{resource}/#{optional_arg}")

        if !res.success? || res.body.has_key?("error")
          raise_exception(res)
        else
          return res.body
        end
      rescue => error
        raise Exception, "There was an error: #{error.message}"
      end
    end
def api_response(resource, optional_arg = nil)
      raise ArgumentError, "You must define a resource to query WaniKani" if resource.nil? || resource.empty?

      begin
        res = client.get("/api/#{@api_version}/user/#{@api_key}/#{resource}/#{optional_arg}")

        if !res.success? || res.body.has_key?("error")
          raise_exception(res)
        else
          return res.body
        end
      rescue => error
        raise Exception, "There was an error: #{error.message}"
      end
    end
Contacts the WaniKani API and returns the data specified.

 @param resource [String] the resource to access.
 @param optional_arg [String] optional arguments for the specified resource.
 @return [Hash] the parsed API response.