class Serverspec::Type::Curl
Public Class Methods
new(name = nil, options = {})
click to toggle source
Calls superclass method
Serverspec::Type::ApiBase::new
# File lib/serverspec_extra_types/types/curl.rb, line 8 def initialize(name = nil, options = {}) super(name, options) @url_base = name end
Public Instance Methods
body()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 21 def body inspection[:body] end
content_type()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 33 def content_type inspection[:content_type] end
http_code()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 29 def http_code response_code end
inspection()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 17 def inspection @inspection ||= get_inspection end
response_code()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 25 def response_code inspection[:http_code] end
size_download()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 37 def size_download inspection[:size_download] end
size_upload()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 41 def size_upload inspection[:size_upload] end
url()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 13 def url @url_base end
Private Instance Methods
extra_args()
click to toggle source
# File lib/serverspec_extra_types/types/curl.rb, line 47 def extra_args "-w \"#{output_format}\"" end
get_inspection()
click to toggle source
rubocop:disable Naming/AccessorMethodName
# File lib/serverspec_extra_types/types/curl.rb, line 52 def get_inspection command = curl_command unless @get_inspection (body, rest) = @runner.run_command(command).stdout.split('!!SS_URL_YAML!!') result = YAML.safe_load(rest).each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; } result[:body] = body @get_inspection = result end @get_inspection end
output_format()
click to toggle source
rubocop:enable Naming/AccessorMethodName
# File lib/serverspec_extra_types/types/curl.rb, line 65 def output_format out = '!!SS_URL_YAML!!---\\n' out << 'http_code: %{http_code}\\n' out << 'content_type: %{content_type}\\n' out << 'size_download: %{size_download}\\n' out << 'size_upload: %{size_upload}\\n' out end