Class: Inspec::Resources::Http::Worker::Remote

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

Instance Attribute Summary collapse

Attributes inherited from Base

#http_method, #opts, #url

Instance Method Summary collapse

Constructor Details

#initialize(inspec, http_method, url, opts) ⇒ Remote

Returns a new instance of Remote.



149
150
151
152
153
154
155
156
157
# File 'lib/resources/http.rb', line 149

def initialize(inspec, http_method, url, opts)
  unless inspec.command('curl').exist?
    raise Inspec::Exceptions::ResourceSkipped,
          'curl is not available on the target machine'
  end

  @inspec = inspec
  super(http_method, url, opts)
end

Instance Attribute Details

#inspecObject (readonly)

Returns the value of attribute inspec.



147
148
149
# File 'lib/resources/http.rb', line 147

def inspec
  @inspec
end

Instance Method Details

#bodyObject



164
165
166
167
# File 'lib/resources/http.rb', line 164

def body
  run_curl
  @body&.strip
end

#response_headersObject



169
170
171
172
# File 'lib/resources/http.rb', line 169

def response_headers
  run_curl
  @response_headers
end

#statusObject



159
160
161
162
# File 'lib/resources/http.rb', line 159

def status
  run_curl
  @status
end