0

I'm in trouble to convert the curl code below to ruby using Rest-Client library.

curl code:

curl https://my_url -u user_token: -F "data[price]=$ 100,00"

Ruby code that I tried without success:

request = RestClient.new 'https://my_url', user: user_token, password: pwd

request.post :data => { :price => '$ 100,00' }, :multipart => true, :verify_ssl => true 
the_bear
  • 1
  • 2
  • Could you show some Ruby code? It's unclear what you are trying to do. – Stefan Jul 29 '15 at 12:56
  • 2
    Welcome to SO! When more information is requested in the comments, it is best to edit your question to add the relevant information so that new viewers will not have to search through the comments to find all they need to help you. Also, if you show some attempt at a solution off the bat, more people will be inclined to give a helping hand. – jkeuhlen Jul 29 '15 at 13:36
  • This is an example which grabs the content of a url: https://www.codecademy.com/courses/ruby-beginner-en-pEdhY/0/1?curriculum_id=5122d839c0a131c35f00013d combining this with the docs for OpenURI (http://ruby-doc.org/stdlib-2.1.5/libdoc/open-uri/rdoc/OpenURI.html) may yield the results you want. – AJFaraday Jul 29 '15 at 13:41
  • @the_bear What is the error you are getting? – james246 Jul 29 '15 at 13:42
  • 1
    no answer, time out. But the curl works well. – the_bear Jul 29 '15 at 13:48
  • http://stackoverflow.com/questions/3692574/how-do-i-do-basic-authentication-with-restclient – dreamingblackcat Jul 30 '15 at 04:38

1 Answers1

0

Try to use a library like curb or curb-fu. They are pretty cool gems and the documentation makes them pretty easy to use.