Class: Inspec::Resources::Http

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

Instance Method Summary collapse

Constructor Details

#initialize(url, method: 'GET', params: nil, auth: {}, headers: {}, data: nil, ssl_verify: true) ⇒ Http

rubocop:disable ParameterLists



28
29
30
31
32
33
34
35
36
# File 'lib/resources/http.rb', line 28

def initialize(url, method: 'GET', params: nil, auth: {}, headers: {}, data: nil, ssl_verify: true)
  @url = url
  @method = method
  @params = params
  @auth = auth
  @headers = headers
  @data = data
  @ssl_verify = ssl_verify
end

Instance Method Details

#bodyObject



42
43
44
# File 'lib/resources/http.rb', line 42

def body
  response.body
end

#headersObject



46
47
48
# File 'lib/resources/http.rb', line 46

def headers
  Hashie::Mash.new(response.headers.to_h)
end

#statusObject



38
39
40
# File 'lib/resources/http.rb', line 38

def status
  response.status
end

#to_sObject



50
51
52
# File 'lib/resources/http.rb', line 50

def to_s
  "http #{@method} on #{@url}"
end