Class: WebCache::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/webcache/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
10
# File 'lib/webcache/response.rb', line 5

def initialize(opts = {})
  case opts
  when HTTP::Response then init_with_http_response opts
  when Hash           then init_with_hash opts
  end
end

Instance Attribute Details

#base_uriObject

Returns the value of attribute base_uri.



3
4
5
# File 'lib/webcache/response.rb', line 3

def base_uri
  @base_uri
end

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/webcache/response.rb', line 3

def code
  @code
end

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/webcache/response.rb', line 3

def content
  @content
end

#errorObject

Returns the value of attribute error.



3
4
5
# File 'lib/webcache/response.rb', line 3

def error
  @error
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/webcache/response.rb', line 16

def success?
  !error
end

#to_sObject



12
13
14
# File 'lib/webcache/response.rb', line 12

def to_s
  content
end