def self.parse(options)
args = Shellwords.split(options)
url = nil
http_method = 'PUT'
headers = {}
until args.empty?
arg = args.shift
case arg
when '-X', '--request'
http_method = remove_arg_for(args, arg)
when '-H'
header_arg = remove_arg_for(args, arg)
headers = headers.merge(parse_header(header_arg))
else
raise StandardError, "#{options} was not a valid curl command. Can't set url to #{arg} it is already set to #{url}" if url
url = arg
end
end
raise StandardError, "#{options} was not a valid curl command" unless url
[
url,
http_method,
headers
]
end