dropio 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/dropio.gemspec +1 -1
- data/lib/dropio/api.rb +3 -2
- data/lib/dropio/client.rb +2 -2
- data/lib/dropio/drop.rb +2 -2
- data/lib/dropio.rb +1 -1
- metadata +1 -1
data/dropio.gemspec
CHANGED
data/lib/dropio/api.rb
CHANGED
@@ -55,14 +55,15 @@ class Dropio::Api
|
|
55
55
|
self.class.post("/drops/#{drop_name}/assets", :body => params)
|
56
56
|
end
|
57
57
|
|
58
|
-
def add_file(drop_name, file_path, comment = nil, token = nil)
|
58
|
+
def add_file(drop_name, file_path, convert_to = nil, pingback_url = nil, comment = nil, token = nil)
|
59
59
|
url = URI.parse("http://assets.drop.io/upload/")
|
60
60
|
r = nil
|
61
61
|
File.open(file_path) do |file|
|
62
62
|
mime_type = (MIME::Types.type_for(file_path)[0] || MIME::Types["application/octet-stream"][0])
|
63
63
|
req = Net::HTTP::Post::Multipart.new url.path,
|
64
64
|
{ 'api_key' => self.class.default_params[:api_key], 'drop_name' => drop_name, 'format' => 'json',
|
65
|
-
'token' => token, 'version' => '2.0', '
|
65
|
+
'token' => token, 'version' => '2.0', 'convert_to' => convert_to, 'pingback_url' => pingback_url,
|
66
|
+
'comment' => comment, 'file' => UploadIO.new(file, mime_type, file_path) }
|
66
67
|
http = Net::HTTP.new(url.host, url.port)
|
67
68
|
r = http.start{|http| http.request(req)}
|
68
69
|
end
|
data/lib/dropio/client.rb
CHANGED
@@ -59,8 +59,8 @@ class Dropio::Client
|
|
59
59
|
a
|
60
60
|
end
|
61
61
|
|
62
|
-
def add_file(drop, file_path, comment = nil)
|
63
|
-
a = handle(:asset, self.service.add_file(drop.name, file_path, drop.default_token
|
62
|
+
def add_file(drop, file_path, convert_to = nil, pingback_url = nil, comment = nil)
|
63
|
+
a = handle(:asset, self.service.add_file(drop.name, file_path, convert_to, pingback_url, comment, drop.default_token))
|
64
64
|
a.drop = drop
|
65
65
|
a
|
66
66
|
end
|
data/lib/dropio/drop.rb
CHANGED
@@ -58,8 +58,8 @@ class Dropio::Drop < Dropio::Resource
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# Adds a file to the Drop given the +file_path+.
|
61
|
-
def add_file(file_path, comment = nil)
|
62
|
-
Dropio::Resource.client.add_file(self, file_path, comment)
|
61
|
+
def add_file(file_path, convert_to = nil, pingback_url = nil, comment = nil)
|
62
|
+
Dropio::Resource.client.add_file(self, file_path, convert_to, pingback_url, comment)
|
63
63
|
end
|
64
64
|
|
65
65
|
# Creates a note with a +title+ and +contents+
|
data/lib/dropio.rb
CHANGED