rscribd 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 0.1.2 / 2008-11-26
2
+
3
+ * Happy Thanksgiving!
4
+ * Potential security issue resolved by having the document's privacy setting set
5
+ in the same request as the upload.
6
+ * Bug fixed where some files with uppercase extensions would not convert.
7
+
1
8
  === 0.1.1 / 2008-10-6
2
9
 
3
10
  * Fixed bug that occurs when parsing empty elements.
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  = rscribd
2
2
 
3
- * 0.1.1 (Oct 6, 2008)
3
+ * 0.1.2 (Nov 26, 2008)
4
4
 
5
5
  == DESCRIPTION:
6
6
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
- Hoe.new('rscribd', '0.1.1') do |p|
6
+ Hoe.new('rscribd', '0.1.2') do |p|
7
7
  p.rubyforge_name = 'rscribd'
8
8
  p.author = 'Jared Friedman'
9
9
  p.email = 'api@scribd.com'
data/lib/scribddoc.rb CHANGED
@@ -104,7 +104,9 @@ module Scribd
104
104
  ext = @attributes[:file].split('.').last unless @attributes[:file].index('.').nil?
105
105
  fields[:doc_type] = @attributes[:type]
106
106
  fields[:doc_type] ||= ext
107
+ fields[:doc_type].downcase! if fields[:doc_type]
107
108
  fields[:rev_id] = @attributes[:doc_id]
109
+ fields[:access] = @attributes[:access]
108
110
  end
109
111
  fields[:session_key] = @attributes[:owner].session_key if @attributes[:owner]
110
112
  response = nil
@@ -138,6 +140,7 @@ module Scribd
138
140
 
139
141
  fields.delete :file
140
142
  fields.delete :type
143
+ fields.delete :access
141
144
 
142
145
  changed_attributes = fields.dup # changed_attributes is what we will stick into @attributes once we update remotely
143
146
 
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 = '4lj2rs4duuv4013y2qbw3'
8
- api_secret = 'sec-twkc39qf22dmplhy3j4flvzet'
7
+ api_key = ''
8
+ api_secret = ''
9
9
 
10
10
  # Create a scribd object
11
11
  Scribd::API.instance.key = api_key
@@ -13,7 +13,35 @@ Scribd::API.instance.secret = api_secret
13
13
  #Scribd::API.instance.debug = true
14
14
 
15
15
  begin
16
- p Scribd::User.login 'NoNameDude', 'NoNamePassword'
16
+ Scribd::User.login 'LOGIN', 'PASSWORD'
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}"
17
45
  rescue Scribd::ResponseError => e
18
46
  puts "failed code=#{e.code} error='#{e.message}'"
19
47
  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.1
4
+ version: 0.1.2
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-06 00:00:00 -07:00
12
+ date: 2008-11-26 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.0
33
+ version: 1.8.2
34
34
  version:
35
35
  description: "== DESCRIPTION: This gem provides a simple and powerful library for the Scribd API, allowing you to write Ruby applications or Ruby on Rails websites that upload, convert, display, search, and control documents in many formats. For more information on the Scribd platform, visit http://www.scribd.com/publisher == FEATURES: * Upload your documents to Scribd's servers and access them using the gem * Upload local files or from remote web sites * Search, tag, and organize documents * Associate documents with your users' accounts"
36
36
  email: api@scribd.com
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements: []
82
82
 
83
83
  rubyforge_project: rscribd
84
- rubygems_version: 1.2.0
84
+ rubygems_version: 1.3.1
85
85
  signing_key:
86
86
  specification_version: 2
87
87
  summary: Ruby client library for the Scribd API