rscribd 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Manifest.txt +14 -0
- data/README.txt +83 -0
- data/Rakefile +18 -0
- data/lib/api.rb +219 -0
- data/lib/doc.rb +233 -0
- data/lib/exceptions.rb +33 -0
- data/lib/multipart.rb +39 -0
- data/lib/resource.rb +158 -0
- data/lib/rscribd.rb +26 -0
- data/lib/user.rb +142 -0
- data/sample/01_upload.rb +47 -0
- data/sample/02_user.rb +44 -0
- data/sample/test.txt +1 -1
- metadata +73 -50
- data/lib/scribd/base.rb +0 -381
- data/lib/scribd/docs.rb +0 -246
- data/lib/scribd/search.rb +0 -85
- data/lib/scribd.rb +0 -3
- data/sample/01-docs_upload-text.rb +0 -30
- data/sample/02-docs_upload-binary.rb +0 -32
- data/sample/03-docs_uploadFromUrl.rb +0 -30
- data/sample/04-docs_changeSettings.rb +0 -53
- data/sample/05-docs_getConversionStatus.rb +0 -39
- data/sample/test.gif +0 -0
data/lib/scribd.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# Example 1 - Uploading a test text file and removing it afterwards.
|
2
|
-
require 'rubygems'
|
3
|
-
require 'scribd'
|
4
|
-
|
5
|
-
# Use your API key / secret here
|
6
|
-
api_key = ''
|
7
|
-
api_secret = ''
|
8
|
-
|
9
|
-
# Create a scribd object
|
10
|
-
scribd = Scribd.new(api_key, api_secret)
|
11
|
-
|
12
|
-
# Enable debugging if you need
|
13
|
-
# scribd.debug = true
|
14
|
-
|
15
|
-
# Get a docs API
|
16
|
-
docs = scribd.docs
|
17
|
-
|
18
|
-
begin
|
19
|
-
# Upload the document from a file
|
20
|
-
print "Uploading a document ... "
|
21
|
-
doc_id, doc_guid = docs.upload('test.txt')
|
22
|
-
puts "Done doc_id=#{doc_id}, doc_guid=#{doc_guid}"
|
23
|
-
|
24
|
-
# Delete the uploaded document
|
25
|
-
print "Deleting a document ... "
|
26
|
-
doc_id = docs.delete(doc_id)
|
27
|
-
puts "Done doc_id=#{doc_id}"
|
28
|
-
rescue Scribd::ResponseError => e
|
29
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
30
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Example 2 - Uploading a test image file and removing it afterwards.
|
2
|
-
#
|
3
|
-
# Note: a different mime-type will be used.
|
4
|
-
require 'rubygems'
|
5
|
-
require 'scribd'
|
6
|
-
|
7
|
-
# Use your API key / secret here
|
8
|
-
api_key = ''
|
9
|
-
api_secret = ''
|
10
|
-
|
11
|
-
# Create a scribd object
|
12
|
-
scribd = Scribd.new(api_key, api_secret)
|
13
|
-
|
14
|
-
# Enable debugging if you need
|
15
|
-
# scribd.debug = true
|
16
|
-
|
17
|
-
# Get a docs API
|
18
|
-
docs = scribd.docs
|
19
|
-
|
20
|
-
begin
|
21
|
-
# Upload the document from a file
|
22
|
-
print "Uploading a document ... "
|
23
|
-
doc_id, doc_guid = docs.upload('test.gif', 'gif')
|
24
|
-
puts "Done doc_id=#{doc_id}, doc_guid=#{doc_guid}"
|
25
|
-
|
26
|
-
# Delete the uploaded document
|
27
|
-
print "Deleting a document ... "
|
28
|
-
doc_id = docs.delete(doc_id)
|
29
|
-
puts "Done doc_id=#{doc_id}"
|
30
|
-
rescue Scribd::ResponseError => e
|
31
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
32
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# Example 2 - Uploading file from a URL and removing it afterwards.
|
2
|
-
require 'rubygems'
|
3
|
-
require 'scribd'
|
4
|
-
|
5
|
-
# Use your API key / secret here
|
6
|
-
api_key = ''
|
7
|
-
api_secret = ''
|
8
|
-
|
9
|
-
# Create a scribd object
|
10
|
-
scribd = Scribd.new(api_key, api_secret)
|
11
|
-
|
12
|
-
# Enable debugging if you need
|
13
|
-
# scribd.debug = true
|
14
|
-
|
15
|
-
# Get a docs API
|
16
|
-
docs = scribd.docs
|
17
|
-
|
18
|
-
begin
|
19
|
-
# Upload the document from a file
|
20
|
-
print "Uploading a document ... "
|
21
|
-
doc_id, doc_guid = docs.upload_from_url('http://www.accesstoinsight.org/lib/authors/walshe/wheel261.pdf', 'pdf')
|
22
|
-
puts "Done doc_id=#{doc_id}, doc_guid=#{doc_guid}"
|
23
|
-
|
24
|
-
# Delete the uploaded document
|
25
|
-
print "Deleting a document ... "
|
26
|
-
doc_id = docs.delete(doc_id)
|
27
|
-
puts "Done doc_id=#{doc_id}"
|
28
|
-
rescue Scribd::ResponseError => e
|
29
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
30
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Example 4 - Uploading a test text file and changing its settings followed
|
2
|
-
# by cleanup.
|
3
|
-
require 'rubygems'
|
4
|
-
require 'scribd'
|
5
|
-
|
6
|
-
# Use your API key / secret here
|
7
|
-
api_key = ''
|
8
|
-
api_secret = ''
|
9
|
-
|
10
|
-
# Create a scribd object
|
11
|
-
scribd = Scribd.new(api_key, api_secret)
|
12
|
-
|
13
|
-
# Enable debugging if you need
|
14
|
-
# scribd.debug = true
|
15
|
-
|
16
|
-
# Get a docs API
|
17
|
-
docs = scribd.docs
|
18
|
-
|
19
|
-
begin
|
20
|
-
# Upload the document from a file
|
21
|
-
print "Uploading a document ... "
|
22
|
-
doc_id, doc_guid = docs.upload('test.txt')
|
23
|
-
puts "Done doc_id=#{doc_id}, doc_guid=#{doc_guid}"
|
24
|
-
|
25
|
-
begin
|
26
|
-
# Change settings of the document
|
27
|
-
print "Changing settings ... "
|
28
|
-
ndoc_id = docs.change_settings(doc_id, {
|
29
|
-
:title => 'New title',
|
30
|
-
:description => 'New description',
|
31
|
-
:display_format => 'html',
|
32
|
-
:access => 'private',
|
33
|
-
:language => 'en',
|
34
|
-
:license => 'c',
|
35
|
-
:allow_word_download => 'false',
|
36
|
-
:allow_text_download => 'true',
|
37
|
-
:allow_pdf_download => 'false',
|
38
|
-
:commenting => 'allow',
|
39
|
-
:parental_advisory => 'safe',
|
40
|
-
:tags => 'test,text'
|
41
|
-
})
|
42
|
-
puts "Done doc_id=#{ndoc_id}"
|
43
|
-
rescue Scribd::ResponseError => e
|
44
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
45
|
-
ensure
|
46
|
-
# Delete the uploaded document
|
47
|
-
print "Deleting a document ... "
|
48
|
-
doc_id = docs.delete(doc_id)
|
49
|
-
puts "Done doc_id=#{doc_id}"
|
50
|
-
end
|
51
|
-
rescue Scribd::ResponseError => e
|
52
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
53
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# Example 5 - Uploading a test text file and checking its conversion status
|
2
|
-
# followed by cleanup.
|
3
|
-
require 'rubygems'
|
4
|
-
require 'scribd'
|
5
|
-
|
6
|
-
# Use your API key / secret here
|
7
|
-
api_key = ''
|
8
|
-
api_secret = ''
|
9
|
-
|
10
|
-
# Create a scribd object
|
11
|
-
scribd = Scribd.new(api_key, api_secret)
|
12
|
-
|
13
|
-
# Enable debugging if you need
|
14
|
-
# scribd.debug = true
|
15
|
-
|
16
|
-
# Get a docs API
|
17
|
-
docs = scribd.docs
|
18
|
-
|
19
|
-
begin
|
20
|
-
# Upload the document from a file
|
21
|
-
print "Uploading a document ... "
|
22
|
-
doc_id, doc_guid = docs.upload('test.txt')
|
23
|
-
puts "Done doc_id=#{doc_id}, doc_guid=#{doc_guid}"
|
24
|
-
|
25
|
-
begin
|
26
|
-
# Check the conversion status
|
27
|
-
print "Getting a conversion status ... "
|
28
|
-
puts docs.get_conversion_status(doc_id)
|
29
|
-
rescue Scribd::ResponseError => e
|
30
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
31
|
-
ensure
|
32
|
-
# Delete the uploaded document
|
33
|
-
print "Deleting a document ... "
|
34
|
-
doc_id = docs.delete(doc_id)
|
35
|
-
puts "Done doc_id=#{doc_id}"
|
36
|
-
end
|
37
|
-
rescue Scribd::ResponseError => e
|
38
|
-
puts "failed code=#{e.code} error='#{e.message}'"
|
39
|
-
end
|
data/sample/test.gif
DELETED
Binary file
|