class InvisibleCollector::Response
Attributes
content[R]
Public Class Methods
new(response, content)
click to toggle source
# File lib/invisible_collector/response.rb, line 7 def initialize(response, content) @success = response.success? @content = content end
Public Instance Methods
error?()
click to toggle source
true if the request failed for some reason
# File lib/invisible_collector/response.rb, line 15 def error? !@success end
presence()
click to toggle source
Returns the content of the response if the request was successful otherwise return nil
. response.presence
is equivalent to
response.present? ? response.content : nil
@return Depends on the actual request made.
# File lib/invisible_collector/response.rb, line 26 def presence @content if success? end
success?()
click to toggle source
true if the request was executed successfully
# File lib/invisible_collector/response.rb, line 33 def success? @success end