Given the following curl will post to my server, what would the equivalent Ruby code that I can use in my automation scripts? I reviewed this post What is the Ruby equivalent to this curl request? but it would be nice to know the curb syntax equivalent for curl's -u admin:admin ... This curl posts successfully
curl -u admin:admin -F":operation=import" -F":contentType=json" -F":name=sample" -F":content={ 'jcr:primaryType': 'nt:unstructured', 'propOne' : 'propOneValue', 'childOne' : { 'childPropOne' : true } }" http://localhost:4502/content/michigan-lsa/stats/en/people/person/jcr%3Acontent
This this ruby code gives a 500 error. Any pointers would be much appreciated
def postProfileContent
@profilePath = "http://localhost:4502/content/michigan-lsa/#{@dept}/en/people/#{@category}/#{@uniqueName}/jcr%3Acontent"
c = Curl::Easy.new
c.url = "#{@profilePath}"
c.verbose = true
c.http_auth_types = :basic
c.username = "admin"
c.password = "admin"
c.enable_cookies = true
c.follow_location = true
puts c.cookies
ask "FINISHED: HTTP #{c.response_code}"
#set post
c.http_post("#{@profilePath}",@jsonContent.to_json)
ask "FINISHED: HTTP #{c.response_code}"
end