Class: NetHttp2::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/net-http2/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Response

Returns a new instance of Response.



6
7
8
9
# File 'lib/net-http2/response.rb', line 6

def initialize(options={})
  @headers = options[:headers]
  @body    = options[:body]
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/net-http2/response.rb', line 4

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



4
5
6
# File 'lib/net-http2/response.rb', line 4

def headers
  @headers
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/net-http2/response.rb', line 15

def ok?
  status == '200'
end

#statusObject



11
12
13
# File 'lib/net-http2/response.rb', line 11

def status
  @headers[':status'] if @headers
end