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) ⇒ Http

rubocop:disable ParameterLists



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

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

Instance Method Details

#bodyObject



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

def body
  response.body
end

#headersObject



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

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

#statusObject



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

def status
  response.status
end

#to_sObject



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

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