Class: Mizuno::ClientResponse

Inherits:
Object
  • Object
show all
Includes:
Rack::Response::Helpers
Defined in:
lib/mizuno/client_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ ClientResponse

Returns a new instance of ClientResponse.



9
10
11
12
# File 'lib/mizuno/client_response.rb', line 9

def initialize(url)
    @url = url
    @headers = Rack::Utils::HeaderHash.new
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/mizuno/client_response.rb', line 7

def body
  @body
end

#headersObject

Returns the value of attribute headers.



7
8
9
# File 'lib/mizuno/client_response.rb', line 7

def headers
  @headers
end

#sslObject

Returns the value of attribute ssl.



7
8
9
# File 'lib/mizuno/client_response.rb', line 7

def ssl
  @ssl
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/mizuno/client_response.rb', line 7

def status
  @status
end

#timeoutObject

Returns the value of attribute timeout.



7
8
9
# File 'lib/mizuno/client_response.rb', line 7

def timeout
  @timeout
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/mizuno/client_response.rb', line 7

def url
  @url
end

Instance Method Details

#[](key) ⇒ Object



14
15
16
# File 'lib/mizuno/client_response.rb', line 14

def [](key)
    @headers[key]
end

#[]=(key, value) ⇒ Object



18
19
20
# File 'lib/mizuno/client_response.rb', line 18

def []=(key, value)
    @headers[key] = value
end

#ssl?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/mizuno/client_response.rb', line 22

def ssl?
    @ssl == true
end

#success?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/mizuno/client_response.rb', line 30

def success?
    successful? or redirect?
end

#timeout?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/mizuno/client_response.rb', line 26

def timeout?
    (@timeout == true) or (@status == 408)
end