dropio 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +6 -0
- data/dropio.gemspec +1 -1
- data/lib/dropio/api.rb +2 -2
- data/lib/dropio/client.rb +2 -2
- data/lib/dropio/drop.rb +2 -2
- data/lib/dropio.rb +1 -1
- data/spec/dropio/drop_spec.rb +9 -1
- metadata +1 -1
data/History.rdoc
CHANGED
data/dropio.gemspec
CHANGED
data/lib/dropio/api.rb
CHANGED
@@ -71,8 +71,8 @@ class Dropio::Api
|
|
71
71
|
(r.nil? or r.body.nil? or r.body.empty?) ? [] : HTTParty::Response.new(Crack::JSON.parse(r.body), r.body, r.code, r.message, r.to_hash)
|
72
72
|
end
|
73
73
|
|
74
|
-
def add_file_from_url(drop_name, url, token = nil)
|
75
|
-
self.class.post("/drops/#{drop_name}/assets", :body => {:token => token, :file_url => url})
|
74
|
+
def add_file_from_url(drop_name, url, convert_to = nil, pingback_url = nil, token = nil)
|
75
|
+
self.class.post("/drops/#{drop_name}/assets", :body => {:token => token, :file_url => url, :convert_to => convert_to, :pingback_url => pingback_url})
|
76
76
|
end
|
77
77
|
|
78
78
|
def assets(drop_name, page = 1, order = :oldest, token = nil)
|
data/lib/dropio/client.rb
CHANGED
@@ -65,8 +65,8 @@ class Dropio::Client
|
|
65
65
|
a
|
66
66
|
end
|
67
67
|
|
68
|
-
def add_file_from_url(drop, url)
|
69
|
-
a = handle(:asset, self.service.add_file_from_url(drop.name, url, drop.default_token))
|
68
|
+
def add_file_from_url(drop, url, convert_to = nil, pingback_url = nil)
|
69
|
+
a = handle(:asset, self.service.add_file_from_url(drop.name, url, convert_to, pingback_url, drop.default_token))
|
70
70
|
a.drop = drop
|
71
71
|
a
|
72
72
|
end
|
data/lib/dropio/drop.rb
CHANGED
@@ -53,8 +53,8 @@ class Dropio::Drop < Dropio::Resource
|
|
53
53
|
end
|
54
54
|
|
55
55
|
# Adds a file to the Drop from a given +url+
|
56
|
-
def add_file_from_url(url)
|
57
|
-
Dropio::Resource.client.add_file_from_url(self,url)
|
56
|
+
def add_file_from_url(url, convert_to = nil, pingback_url = nil)
|
57
|
+
Dropio::Resource.client.add_file_from_url(self,url, convert_to, pingback_url)
|
58
58
|
end
|
59
59
|
|
60
60
|
# Adds a file to the Drop given the +file_path+.
|
data/lib/dropio.rb
CHANGED
data/spec/dropio/drop_spec.rb
CHANGED
@@ -90,10 +90,18 @@ describe Drop do
|
|
90
90
|
@asset = stub(Asset)
|
91
91
|
@asset.should_receive(:drop=).once
|
92
92
|
@client.should_receive(:handle).with(:asset,{}).and_return(@asset)
|
93
|
-
@api.should_receive(:add_file_from_url).with(@mydrop.name,"http://myurl.com/myfile.txt"
|
93
|
+
@api.should_receive(:add_file_from_url).with(@mydrop.name,"http://myurl.com/myfile.txt", nil, nil, @mydrop.default_token).and_return({})
|
94
94
|
@mydrop.add_file_from_url("http://myurl.com/myfile.txt").should == @asset
|
95
95
|
end
|
96
96
|
|
97
|
+
it "should add files from a url with conversion and pingback url" do
|
98
|
+
@asset = stub(Asset)
|
99
|
+
@asset.should_receive(:drop=).once
|
100
|
+
@client.should_receive(:handle).with(:asset,{}).and_return(@asset)
|
101
|
+
@api.should_receive(:add_file_from_url).with(@mydrop.name,"http://myurl.com/myfile.txt", 'H264_HIGH_RES', 'http://drop.io/test/pinged', @mydrop.default_token).and_return({})
|
102
|
+
@mydrop.add_file_from_url("http://myurl.com/myfile.txt", 'H264_HIGH_RES', 'http://drop.io/test/pinged').should == @asset
|
103
|
+
end
|
104
|
+
|
97
105
|
it "should add files from a path" do
|
98
106
|
@asset = stub(Asset)
|
99
107
|
@asset.should_receive(:drop=).once
|