Module: CurlHelper
- Included in:
- LabClient::Klass, LabClient::LabStruct, LabClient::PaginatedResponse, Typhoeus::Response
- Defined in:
- lib/labclient/curl.rb
Overview
Generate a curl example
Instance Method Summary collapse
-
#curl ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Method Details
#curl ⇒ Object
rubocop:disable Metrics/AbcSize
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/labclient/curl.rb', line 4 def curl output = 'curl ' output += '-k ' unless client.settings[:ssl_verify] method = response.request.[:method] output += "-X #{method.upcase} " # output = "-H " response.request.[:headers].each do |key, value| # Hide JSON if GET next if key == 'User-Agent' # Don't bother with agent next if key == 'Expect' # Typheous Specific next if key == 'Content-Type' && method == :get output += "-H \"#{key}: #{value}\" " end output += "-d '#{response.request.[:body]}' " if method != :get output += "\"#{response.request.url}\"" puts output end |