Class: Curlyrest::CurlResponse

Inherits:
Object
  • Object
show all
Includes:
Net::HTTPHeader
Defined in:
lib/curlyrest.rb

Overview

class for a constructing a curl response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_version, status, message = '') ⇒ CurlResponse

Returns a new instance of CurlResponse.



12
13
14
15
16
17
18
19
# File 'lib/curlyrest.rb', line 12

def initialize(http_version, status, message = '')
  @message = message
  @http_version = http_version
  @code = status
  @body = ''
  @inflate = Zlib::Inflate.new(32 + Zlib::MAX_WBITS)
  initialize_http_header nil
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



11
12
13
# File 'lib/curlyrest.rb', line 11

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



10
11
12
# File 'lib/curlyrest.rb', line 10

def code
  @code
end

#headersObject (readonly)

Returns the value of attribute headers.



10
11
12
# File 'lib/curlyrest.rb', line 10

def headers
  @headers
end

#http_versionObject (readonly)

Returns the value of attribute http_version.



10
11
12
# File 'lib/curlyrest.rb', line 10

def http_version
  @http_version
end

#inflateObject

Returns the value of attribute inflate.



11
12
13
# File 'lib/curlyrest.rb', line 11

def inflate
  @inflate
end

#messageObject (readonly)

Returns the value of attribute message.



10
11
12
# File 'lib/curlyrest.rb', line 10

def message
  @message
end

Instance Method Details

#unzip_body(gzip) ⇒ Object



21
22
23
# File 'lib/curlyrest.rb', line 21

def unzip_body(gzip)
  @body = @inflate.inflate(gzip)
end