title: How to convert a specific curl code to ruby code with restclient
body: <p><a href="https://i.stack.imgur.com/CNOtC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CNOtC.png" alt="API definition"></a>I would like to convert  following <code>curl</code> code to <code>ruby</code>.</p>
  
  <pre><code>curl -u "my_username":"my_pass" \
       -X POST \
       -F "positive_examples=@/Users/abc/Downloads/tiger.zip" \
       -F "negative_examples=@/Users/abc/Downloads/leopard.zip" \
       -F "name=tiger" \
       "http://localhost/api/v2/class"
  </code></pre>
  
  <p>Finally, I could convert the curl example to Ruby, follow the example in ruby:</p>
  
  <pre><code>request = RestClient::Request.new(method: :post,
  url: 'http://localhost/api/v2/class',
  user: 'my_username', 
  password: 'my_pass',
  payload: {multipart:true, 
      positive_examples:File.new("/Users/abc/Downloads/tiger.zip", 'rb'),
      negative_examples:File.new("/Users/abc/Downloads/leopard.zip", 'rb')
      name:'tiger'})
  </code></pre>