rscribd 0.1.0 → 0.1.1
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 +4 -0
- data/README.txt +1 -1
- data/Rakefile +1 -1
- data/lib/scribdresource.rb +1 -1
- data/sample/01_upload.rb +3 -31
- metadata +2 -2
data/History.txt
CHANGED
data/README.txt
CHANGED
data/Rakefile
CHANGED
data/lib/scribdresource.rb
CHANGED
@@ -144,7 +144,7 @@ module Scribd
|
|
144
144
|
@attributes.clear
|
145
145
|
xml.each_element do |element|
|
146
146
|
text = if element.text.nil? or element.text.chomp.strip.empty? then
|
147
|
-
element.cdatas ? element.cdatas.first.value : nil
|
147
|
+
(element.cdatas and not element.cdatas.empty?) ? element.cdatas.first.value : nil
|
148
148
|
else
|
149
149
|
element.text
|
150
150
|
end
|
data/sample/01_upload.rb
CHANGED
@@ -4,8 +4,8 @@ require 'rubygems'
|
|
4
4
|
require 'rscribd'
|
5
5
|
|
6
6
|
# Use your API key / secret here
|
7
|
-
api_key = ''
|
8
|
-
api_secret = ''
|
7
|
+
api_key = '4lj2rs4duuv4013y2qbw3'
|
8
|
+
api_secret = 'sec-twkc39qf22dmplhy3j4flvzet'
|
9
9
|
|
10
10
|
# Create a scribd object
|
11
11
|
Scribd::API.instance.key = api_key
|
@@ -13,35 +13,7 @@ Scribd::API.instance.secret = api_secret
|
|
13
13
|
#Scribd::API.instance.debug = true
|
14
14
|
|
15
15
|
begin
|
16
|
-
Scribd::User.login '
|
17
|
-
# Upload the document from a file
|
18
|
-
print "Uploading a document ... "
|
19
|
-
|
20
|
-
doc = Scribd::Document.upload(:file => 'test.txt')
|
21
|
-
puts "Done doc_id=#{doc.id}, doc_access_key=#{doc.access_key}"
|
22
|
-
|
23
|
-
# Poll API until conversion is complete
|
24
|
-
while (doc.conversion_status == 'PROCESSING')
|
25
|
-
puts "Document conversion is processing"
|
26
|
-
sleep(2) # Very important to sleep to prevent a runaway loop that will get your app blocked
|
27
|
-
end
|
28
|
-
puts "Document conversion is complete"
|
29
|
-
|
30
|
-
# Edit various options of the document
|
31
|
-
# Note you can also edit options before your doc is done converting
|
32
|
-
doc.title = 'This is a test doc!'
|
33
|
-
doc.description = "I'm testing out the Scribd API!"
|
34
|
-
doc.access = 'private'
|
35
|
-
doc.language = 'en'
|
36
|
-
doc.license = 'c'
|
37
|
-
doc.tags = 'test,api'
|
38
|
-
doc.show_ads = true
|
39
|
-
doc.save
|
40
|
-
|
41
|
-
# Delete the uploaded document
|
42
|
-
print "Deleting a document ... "
|
43
|
-
doc.destroy
|
44
|
-
puts "Done doc_id=#{doc.id}"
|
16
|
+
p Scribd::User.login 'NoNameDude', 'NoNamePassword'
|
45
17
|
rescue Scribd::ResponseError => e
|
46
18
|
puts "failed code=#{e.code} error='#{e.message}'"
|
47
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rscribd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Friedman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|