class Plagiarism::Response
Attributes
doc[RW]
response[RW]
Public Class Methods
new(response)
click to toggle source
# File lib/plagiarism/response.rb, line 9 def initialize(response) @response = response @doc = Nokogiri::XML(response.body) if @response.ok? end
Public Instance Methods
body()
click to toggle source
Return the body of the response
# File lib/plagiarism/response.rb, line 28 def body @response ? @response.response.body : nil end
error?()
click to toggle source
Return true if the API call did not succeed
# File lib/plagiarism/response.rb, line 22 def error? not success? end
status_code()
click to toggle source
Return the HTTP status code from the response
# File lib/plagiarism/response.rb, line 34 def status_code @response ? @response.response.code : nil end
success?()
click to toggle source
Return true if the API call succeeded
# File lib/plagiarism/response.rb, line 16 def success? @response.ok? && @doc.css("error").text == "" end