Class: Puppet::HTTP::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(nethttp) ⇒ Response

Returns a new instance of Response.


2
3
4
# File 'lib/puppet/http/response.rb', line 2

def initialize(nethttp)
  @nethttp = nethttp
end

Instance Method Details

#[](name) ⇒ Object


26
27
28
# File 'lib/puppet/http/response.rb', line 26

def [](name)
  @nethttp[name]
end

#bodyObject


14
15
16
# File 'lib/puppet/http/response.rb', line 14

def body
  @nethttp.body
end

#codeObject


6
7
8
# File 'lib/puppet/http/response.rb', line 6

def code
  @nethttp.code.to_i
end

#drainObject


30
31
32
33
# File 'lib/puppet/http/response.rb', line 30

def drain
  body
  true
end

#read_body(&block) ⇒ Object


18
19
20
# File 'lib/puppet/http/response.rb', line 18

def read_body(&block)
  @nethttp.read_body(&block)
end

#reasonObject


10
11
12
# File 'lib/puppet/http/response.rb', line 10

def reason
  @nethttp.message
end

#success?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/puppet/http/response.rb', line 22

def success?
  @nethttp.is_a?(Net::HTTPSuccess)
end