<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/viddler.yml.sample</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,3 @@
 doc
 log/*.log
+test/viddler.yml</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ require 'fileutils'
 include FileUtils
 
 require 'rubygems'
-%w[rake hoe newgem rubigen active_support rest_client mime/types].each do |req_gem|
+%w[rake hoe newgem rubigen active_support curb].each do |req_gem|
   begin
     require req_gem
   rescue LoadError</diff>
      <filename>config/requirements.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,13 +4,13 @@ $:.unshift(File.dirname(__FILE__)) unless
 require 'rubygems'
 require 'active_support'
 require 'ostruct'
+require 'curb'
 
 require 'ext/open_struct'
 require 'ext/hash'
 require 'ext/array'
 require 'viddler/api_spec'
 require 'viddler/base'
-require 'viddler/multipart_params'
 require 'viddler/request'
 require 'viddler/video'
 require 'viddler/comment'
@@ -18,4 +18,4 @@ require 'viddler/user'
 
 # Module to encapsule the Viddler API.
 module Viddler
-end
\ No newline at end of file
+end</diff>
      <filename>lib/viddler.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,3 @@
-require 'rest_client'
-
 module Viddler
   
   # Raised when response from Viddler contains absolutely no data
@@ -17,16 +15,14 @@ module Viddler
   class Request #:nodoc:
     
     API_URL = 'http://api.viddler.com/rest/v1/'
-    DEFAULT_HEADERS = {:accept =&gt; 'application/xml', :content_type =&gt; 'application/x-www-form-urlencoded'}
   
-    attr_accessor :url, :http_method, :response, :body
-    attr_reader :headers, :params
+    attr_accessor :url, :http_method, :response
+    attr_reader :params
   
     def initialize(http_method, method) #:nodoc:
       @http_method = http_method.to_s
       @url = API_URL
       self.params = {:method =&gt; viddlerize(method)}    
-      self.headers = DEFAULT_HEADERS
     end
     
     # Use this method to setup your request's payload and headers.
@@ -53,22 +49,35 @@ module Viddler
       if block_given?
         set(:params, &amp;block)
       end
+
+      c = Curl::Easy.new(url)
+      c.headers['Accept'] = 'application/xml'
     
       if post? and multipart?
-        put_multipart_params_into_body
+        c.multipart_form_post = true
+        c.http_post(*build_params)
       else
-        put_params_into_url
-      end    
-      request = RestClient::Request.execute(
-         :method =&gt; http_method, 
-         :url =&gt; url, 
-         :headers =&gt; headers, 
-         :payload =&gt; body
-       )
-       self.response = parse_response(request)
+        c.url = url_with_params
+        c.perform
+      end
+
+      self.response = parse_response(c.body_str)
     end
   
     private
+
+    def build_params
+      f = []
+      t = []
+      params.each do |key, value| 
+        if value.is_a? File
+          f &lt;&lt; Curl::PostField.file(key.to_s, value.path, File.basename(value.path))
+        else
+          t &lt;&lt; Curl::PostField.content(key.to_s, value.to_s)
+        end
+      end
+      t + f
+    end
   
     def parse_response(raw_response)
       raise EmptyResponseError if raw_response.blank?
@@ -79,14 +88,8 @@ module Viddler
       response_hash
     end
   
-    def put_multipart_params_into_body
-      multiparams = MultipartParams.new(params)
-      self.body = multiparams.body
-      self.headers = {:content_type =&gt; multiparams.content_type}
-    end
-  
-    def put_params_into_url
-      self.url = self.url + '?' + params.to_query
+    def url_with_params
+      self.url + '?' + params.to_query
     end
   
     def viddlerize(name)
@@ -102,11 +105,6 @@ module Viddler
       @params.update(hash)
     end
   
-    def headers=(hash) #:nodoc:
-      @headers ||= Hash.new
-      @headers.update(hash)
-    end
-  
     def multipart? #:nodoc:
       if params.find{|k,v| v.is_a?(File)} then true else false end
     end</diff>
      <filename>lib/viddler/request.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,4 @@
 require 'test/unit'
+require 'ruby_debug'
 require 'viddler'
+require 'yaml'</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,45 +1,27 @@
 require File.dirname(__FILE__) + '/test_helper.rb'
 
 class ViddlerTest &lt; Test::Unit::TestCase
-  class KeyRequired &lt; Exception
-    def message
-      'In order to run this test, insert working Viddler API key inside API_KEY constant.'
-    end
-  end  
-  
-  class CredentialsRequired &lt; Exception
-    def message
-      'In order to run this test, insert working Viddler username and password inside LOGIN and PASSWORD constants.'
-    end
-  end
-  
-  # In order to run the tests you need a working Viddler account and an API key.
-  API_KEY               = nil
-  LOGIN                 = nil
-  PASSWORD              = nil
-  TEST_VIDEO_FILE_PATH  = '/path/to/video'
+
+  TEST_VIDEO_FILE_PATH  = '/home/petyo/Test/sample.vob'
   
   def setup
-    raise KeyRequired unless API_KEY
-    @viddler = Viddler::Base.new(API_KEY, LOGIN, PASSWORD)
+    config = YAML.load_file File.join(File.dirname(__FILE__), 'viddler.yml') rescue &quot;you need test/viddler.yml, check viddler.yml.example for credentals.&quot;
+    @viddler = Viddler::Base.new(config['api_key'], config['login'], config['password'])
   end
 
   def test_should_authenticate
-    credentials_required
     @viddler.authenticate
     assert @viddler.authenticated?
   end
   
   def test_should_get_record_token
-    credentials_required
     token = @viddler.get_record_token
     assert_kind_of String, token
   end
   
   def test_should_upload_video
-    credentials_required
     file = File.open(TEST_VIDEO_FILE_PATH)
-    video = @viddler.upload_video(:file =&gt; file, :title =&gt; 'Testing', :description =&gt; 'Bla', :tags =&gt; 'one, two, three')
+    video = @viddler.upload_video(:file =&gt; file, :title =&gt; 'Testing', :description =&gt; 'Bla', :tags =&gt; 'one, two, three', :make_public =&gt; '1')
   end
   
   def test_should_find_profile
@@ -48,7 +30,6 @@ class ViddlerTest &lt; Test::Unit::TestCase
   end
   
   def test_should_update_profile
-    credentials_required
     user = @viddler.update_profile(:first_name =&gt; 'Ilya', 
                                    :last_name =&gt; 'Sabanin', 
                                    :about_me =&gt; 'A guy', 
@@ -60,13 +41,14 @@ class ViddlerTest &lt; Test::Unit::TestCase
   end
   
   def test_should_update_account
-    credentials_required
     assert @viddler.update_account(:show_account =&gt; '0')
   end
   
+=begin
   def test_should_get_video_status
-    assert @viddler.get_video_status('f8605d95')
+    assert @viddler.get_video_status('6b0b9af1')
   end
+=end
   
   def test_should_find_video_by_id
     video = @viddler.find_video_by_id('6b0b9af1')
@@ -98,11 +80,5 @@ class ViddlerTest &lt; Test::Unit::TestCase
     videos = @viddler.find_all_featured_videos
     assert_kind_of Viddler::Video, videos.first
   end
-  
-  private
-  
-  def credentials_required
-    raise CredentialsRequired unless LOGIN and PASSWORD
-  end
 
 end</diff>
      <filename>test/test_viddler.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/viddler/multipart_params.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>222846882a8b62f7b60425134f3044ce049a7af4</id>
    </parent>
  </parents>
  <author>
    <name>Petyo Ivanov</name>
    <email>underlog@gmail.com</email>
  </author>
  <url>http://github.com/iSabanin/viddler/commit/6ed9839fa0328909cf04c5a05abc127babab99a0</url>
  <id>6ed9839fa0328909cf04c5a05abc127babab99a0</id>
  <committed-date>2009-04-11T07:48:12-07:00</committed-date>
  <authored-date>2009-04-11T07:48:12-07:00</authored-date>
  <message>Swapped rest-client and homecooked multipart with curb, which uses C bindings to curl... Maybe it will be faster.</message>
  <tree>bf6bce0908d3d57e4ba2456cb3dddfd17686a8a6</tree>
  <committer>
    <name>Petyo Ivanov</name>
    <email>underlog@gmail.com</email>
  </committer>
</commit>
