Class: Inspec::Resources::Http
- Inherits:
-
Object
- Object
- Inspec::Resources::Http
- Defined in:
- lib/resources/http.rb
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(url, method: 'GET', params: nil, auth: {}, headers: {}, data: nil) ⇒ Http
constructor
rubocop:disable ParameterLists.
- #status ⇒ Object
- #to_s ⇒ Object
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
#body ⇒ Object
41 42 43 |
# File 'lib/resources/http.rb', line 41 def body response.body end |
#headers ⇒ Object
45 46 47 |
# File 'lib/resources/http.rb', line 45 def headers Hashie::Mash.new(response.headers.to_h) end |
#status ⇒ Object
37 38 39 |
# File 'lib/resources/http.rb', line 37 def status response.status end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/resources/http.rb', line 49 def to_s "http #{@method} on #{@url}" end |