rapidshare-ext 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -17
- data/History.md +8 -0
- data/README.md +243 -221
- data/Rakefile +3 -3
- data/lib/rapidshare-base/api.rb +136 -6
- data/lib/rapidshare-base/utils.rb +39 -0
- data/lib/rapidshare-ext.rb +17 -11
- data/lib/rapidshare-ext/api.rb +531 -531
- data/lib/rapidshare-ext/download.rb +79 -7
- data/lib/rapidshare-ext/version.rb +5 -5
- data/rapidshare-ext.gemspec +11 -10
- data/test/fixtures/checkfiles_multi.txt +3 -0
- data/test/fixtures/checkfiles_single.txt +1 -0
- data/test/fixtures/files/upload3.txt +100 -0
- data/test/fixtures/getrapidtranslogs.txt +5 -0
- data/test/integration/rapidshare-base_test.rb +278 -0
- data/test/integration/rapidshare-ext_test.rb +176 -95
- data/test/test_helper.rb +43 -43
- data/test/unit/rapidshare-ext_test.rb +27 -27
- data/tmp/.gitignore +2 -0
- metadata +56 -29
data/test/test_helper.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'shoulda'
|
3
|
-
require 'fakeweb'
|
4
|
-
|
5
|
-
require 'rapidshare-ext'
|
6
|
-
|
7
|
-
class Test::Unit::TestCase
|
8
|
-
|
9
|
-
# don't allow internet connections for testing (we should use fixtures, except
|
10
|
-
# integration testing)
|
11
|
-
FakeWeb.allow_net_connect = false
|
12
|
-
|
13
|
-
def read_fixture(filename, extension = 'txt')
|
14
|
-
# add extension to file unless it already has it
|
15
|
-
filename += ".#{extension}" unless (filename =~ /\.\w+$/)
|
16
|
-
|
17
|
-
File.read File.expand_path(File.dirname(__FILE__) + "/fixtures/#{filename}")
|
18
|
-
end
|
19
|
-
|
20
|
-
# general setup, can be overriden or extended in specific tests
|
21
|
-
#
|
22
|
-
def setup
|
23
|
-
@cookie = 'F0EEB41B38363A41F0D125102637DB7236468731F8DB760DC57934B4714C8D13'
|
24
|
-
|
25
|
-
# mock http requests for login into Rapidshare
|
26
|
-
#
|
27
|
-
FakeWeb.register_uri(:get,
|
28
|
-
'https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails&login=valid_login&password=valid_password&withcookie=1&cookie=',
|
29
|
-
:body => read_fixture('getaccountdetails_valid.txt')
|
30
|
-
)
|
31
|
-
|
32
|
-
FakeWeb.register_uri(:get,
|
33
|
-
"https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails&cookie=#{@cookie}",
|
34
|
-
:body => read_fixture('getaccountdetails_valid.txt')
|
35
|
-
)
|
36
|
-
|
37
|
-
@rs = Rapidshare::API.new(:login => 'valid_login', :password => 'valid_password')
|
38
|
-
end
|
39
|
-
|
40
|
-
def upload local_path, remote_filename, remote_dir
|
41
|
-
|
42
|
-
end
|
43
|
-
|
1
|
+
require 'test/unit'
|
2
|
+
require 'shoulda'
|
3
|
+
require 'fakeweb'
|
4
|
+
|
5
|
+
require 'rapidshare-ext'
|
6
|
+
|
7
|
+
class Test::Unit::TestCase
|
8
|
+
|
9
|
+
# don't allow internet connections for testing (we should use fixtures, except
|
10
|
+
# integration testing)
|
11
|
+
FakeWeb.allow_net_connect = false
|
12
|
+
|
13
|
+
def read_fixture(filename, extension = 'txt')
|
14
|
+
# add extension to file unless it already has it
|
15
|
+
filename += ".#{extension}" unless (filename =~ /\.\w+$/)
|
16
|
+
|
17
|
+
File.read File.expand_path(File.dirname(__FILE__) + "/fixtures/#{filename}")
|
18
|
+
end
|
19
|
+
|
20
|
+
# general setup, can be overriden or extended in specific tests
|
21
|
+
#
|
22
|
+
def setup
|
23
|
+
@cookie = 'F0EEB41B38363A41F0D125102637DB7236468731F8DB760DC57934B4714C8D13'
|
24
|
+
|
25
|
+
# mock http requests for login into Rapidshare
|
26
|
+
#
|
27
|
+
FakeWeb.register_uri(:get,
|
28
|
+
'https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails&login=valid_login&password=valid_password&withcookie=1&cookie=',
|
29
|
+
:body => read_fixture('getaccountdetails_valid.txt')
|
30
|
+
)
|
31
|
+
|
32
|
+
FakeWeb.register_uri(:get,
|
33
|
+
"https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails&cookie=#{@cookie}",
|
34
|
+
:body => read_fixture('getaccountdetails_valid.txt')
|
35
|
+
)
|
36
|
+
|
37
|
+
@rs = Rapidshare::API.new(:login => 'valid_login', :password => 'valid_password')
|
38
|
+
end
|
39
|
+
|
40
|
+
def upload local_path, remote_filename, remote_dir
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
44
|
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class RapidshareExtTest < Test::Unit::TestCase
|
4
|
-
context
|
5
|
-
should
|
6
|
-
assert_respond_to @rs, :add_folder
|
7
|
-
assert_respond_to @rs, :remove_folder
|
8
|
-
assert_respond_to @rs, :move_folder
|
9
|
-
assert_respond_to @rs, :upload
|
10
|
-
assert_respond_to @rs, :remove_file
|
11
|
-
assert_respond_to @rs, :rename_file
|
12
|
-
assert_respond_to @rs, :folders_hierarchy
|
13
|
-
assert_respond_to @rs, :folders_hierarchy!
|
14
|
-
assert_respond_to @rs, :slice_tree
|
15
|
-
assert_respond_to @rs, :remove_orphans!
|
16
|
-
assert_respond_to @rs, :move_orphans
|
17
|
-
assert_respond_to @rs, :detect_gaps
|
18
|
-
assert_respond_to @rs, :erase_all_data!
|
19
|
-
assert_respond_to @rs, :root_folder?
|
20
|
-
assert_respond_to @rs, :gap?
|
21
|
-
assert_respond_to @rs, :orphan?
|
22
|
-
assert_respond_to @rs, :folder_path
|
23
|
-
assert_respond_to @rs, :folder_id
|
24
|
-
assert_respond_to @rs, :file_info
|
25
|
-
assert_respond_to @rs, :file_id
|
26
|
-
end
|
27
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RapidshareExtTest < Test::Unit::TestCase
|
4
|
+
context 'Interface' do
|
5
|
+
should 'Respond to certain methods' do
|
6
|
+
assert_respond_to @rs, :add_folder
|
7
|
+
assert_respond_to @rs, :remove_folder
|
8
|
+
assert_respond_to @rs, :move_folder
|
9
|
+
assert_respond_to @rs, :upload
|
10
|
+
assert_respond_to @rs, :remove_file
|
11
|
+
assert_respond_to @rs, :rename_file
|
12
|
+
assert_respond_to @rs, :folders_hierarchy
|
13
|
+
assert_respond_to @rs, :folders_hierarchy!
|
14
|
+
assert_respond_to @rs, :slice_tree
|
15
|
+
assert_respond_to @rs, :remove_orphans!
|
16
|
+
assert_respond_to @rs, :move_orphans
|
17
|
+
assert_respond_to @rs, :detect_gaps
|
18
|
+
assert_respond_to @rs, :erase_all_data!
|
19
|
+
assert_respond_to @rs, :root_folder?
|
20
|
+
assert_respond_to @rs, :gap?
|
21
|
+
assert_respond_to @rs, :orphan?
|
22
|
+
assert_respond_to @rs, :folder_path
|
23
|
+
assert_respond_to @rs, :folder_id
|
24
|
+
assert_respond_to @rs, :file_info
|
25
|
+
assert_respond_to @rs, :file_id
|
26
|
+
end
|
27
|
+
end
|
28
28
|
end
|
data/tmp/.gitignore
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapidshare-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,16 +9,16 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rest-client
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.6.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,87 +26,103 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.6.7
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: test-unit
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
38
|
-
type: :
|
37
|
+
version: 2.5.4
|
38
|
+
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 2.5.4
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: shoulda
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 3.3.2
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.3.2
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: simplecov
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 0.7.1
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 0.7.1
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: fakeweb
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: 1.3.0
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
93
|
+
version: 1.3.0
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: mocha
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.13.2
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.13.2
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
96
112
|
requirement: !ruby/object:Gem::Requirement
|
97
113
|
none: false
|
98
114
|
requirements:
|
99
|
-
- -
|
115
|
+
- - ~>
|
100
116
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
117
|
+
version: 10.0.3
|
102
118
|
type: :development
|
103
119
|
prerelease: false
|
104
120
|
version_requirements: !ruby/object:Gem::Requirement
|
105
121
|
none: false
|
106
122
|
requirements:
|
107
|
-
- -
|
123
|
+
- - ~>
|
108
124
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
125
|
+
version: 10.0.3
|
110
126
|
description: Extends the original rapidshare gem with a set of handy features
|
111
127
|
email:
|
112
128
|
- odiszapc@gmail.com
|
@@ -127,12 +143,18 @@ files:
|
|
127
143
|
- lib/rapidshare-ext/download.rb
|
128
144
|
- lib/rapidshare-ext/version.rb
|
129
145
|
- rapidshare-ext.gemspec
|
146
|
+
- test/fixtures/checkfiles_multi.txt
|
147
|
+
- test/fixtures/checkfiles_single.txt
|
130
148
|
- test/fixtures/files/upload1.txt
|
131
149
|
- test/fixtures/files/upload2.txt
|
150
|
+
- test/fixtures/files/upload3.txt
|
132
151
|
- test/fixtures/getaccountdetails_valid.txt
|
152
|
+
- test/fixtures/getrapidtranslogs.txt
|
153
|
+
- test/integration/rapidshare-base_test.rb
|
133
154
|
- test/integration/rapidshare-ext_test.rb
|
134
155
|
- test/test_helper.rb
|
135
156
|
- test/unit/rapidshare-ext_test.rb
|
157
|
+
- tmp/.gitignore
|
136
158
|
homepage: http://github.com/odiszapc/rapidshare-ext
|
137
159
|
licenses: []
|
138
160
|
post_install_message:
|
@@ -160,9 +182,14 @@ summary: ! 'Makes your interactions with Rapidshare API more pleasant by providi
|
|
160
182
|
new handy features: creating/moving/deleting files/folders in a user friendly way,
|
161
183
|
upload files, etc'
|
162
184
|
test_files:
|
185
|
+
- test/fixtures/checkfiles_multi.txt
|
186
|
+
- test/fixtures/checkfiles_single.txt
|
163
187
|
- test/fixtures/files/upload1.txt
|
164
188
|
- test/fixtures/files/upload2.txt
|
189
|
+
- test/fixtures/files/upload3.txt
|
165
190
|
- test/fixtures/getaccountdetails_valid.txt
|
191
|
+
- test/fixtures/getrapidtranslogs.txt
|
192
|
+
- test/integration/rapidshare-base_test.rb
|
166
193
|
- test/integration/rapidshare-ext_test.rb
|
167
194
|
- test/test_helper.rb
|
168
195
|
- test/unit/rapidshare-ext_test.rb
|