rscribd 0.0.3 → 0.0.4
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/Manifest.txt +6 -6
- data/README.txt +4 -3
- data/Rakefile +1 -1
- data/lib/rscribd.rb +12 -6
- data/lib/{api.rb → scribdapi.rb} +1 -1
- data/lib/{doc.rb → scribddoc.rb} +4 -4
- data/lib/{exceptions.rb → scribderrors.rb} +6 -5
- data/lib/{multipart.rb → scribdmultiparthack.rb} +5 -4
- data/lib/{resource.rb → scribdresource.rb} +2 -2
- data/lib/{user.rb → scribduser.rb} +1 -1
- metadata +9 -9
    
        data/History.txt
    CHANGED
    
    
    
        data/Manifest.txt
    CHANGED
    
    | @@ -2,13 +2,13 @@ History.txt | |
| 2 2 | 
             
            Manifest.txt
         | 
| 3 3 | 
             
            README.txt
         | 
| 4 4 | 
             
            Rakefile
         | 
| 5 | 
            -
            lib/ | 
| 6 | 
            -
            lib/ | 
| 7 | 
            -
            lib/ | 
| 8 | 
            -
            lib/ | 
| 9 | 
            -
            lib/ | 
| 5 | 
            +
            lib/scribdapi.rb
         | 
| 6 | 
            +
            lib/scribddoc.rb
         | 
| 7 | 
            +
            lib/scribderrors.rb
         | 
| 8 | 
            +
            lib/scribdmultiparthack.rb
         | 
| 9 | 
            +
            lib/scribdresource.rb
         | 
| 10 10 | 
             
            lib/rscribd.rb
         | 
| 11 | 
            -
            lib/ | 
| 11 | 
            +
            lib/scribduser.rb
         | 
| 12 12 | 
             
            sample/01_upload.rb
         | 
| 13 13 | 
             
            sample/02_user.rb
         | 
| 14 14 | 
             
            sample/test.txt
         | 
    
        data/README.txt
    CHANGED
    
    | @@ -1,14 +1,15 @@ | |
| 1 1 | 
             
            = rscribd
         | 
| 2 2 |  | 
| 3 | 
            -
            *  | 
| 3 | 
            +
            * 0.0.4 (Feb 20, 2007)
         | 
| 4 4 |  | 
| 5 5 | 
             
            == DESCRIPTION:
         | 
| 6 6 |  | 
| 7 7 | 
             
            This gem provides a simple and powerful library for the Scribd API, allowing you
         | 
| 8 8 | 
             
            to write Ruby applications or Ruby on Rails websites that upload, convert,
         | 
| 9 | 
            -
            display, search, and control documents in many formats.
         | 
| 9 | 
            +
            display, search, and control documents in many formats. For more information on
         | 
| 10 | 
            +
            the Scribd platform, visit http://www.scribd.com/platform
         | 
| 10 11 |  | 
| 11 | 
            -
            == FEATURES | 
| 12 | 
            +
            == FEATURES:
         | 
| 12 13 |  | 
| 13 14 | 
             
            * Upload your documents to Scribd's servers and access them using the gem
         | 
| 14 15 | 
             
            * Upload local files or from remote web sites
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/rscribd.rb
    CHANGED
    
    | @@ -1,5 +1,8 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 2 |  | 
| 3 | 
            +
            module Scribd # :nodoc:
         | 
| 4 | 
            +
            end
         | 
| 5 | 
            +
             | 
| 3 6 | 
             
            class Hash #:nodoc:
         | 
| 4 7 | 
             
               # Taken from Rails, with appreciation to DHH
         | 
| 5 8 | 
             
               def stringify_keys
         | 
| @@ -18,9 +21,12 @@ class Array #:nodoc: | |
| 18 21 | 
             
              end
         | 
| 19 22 | 
             
            end
         | 
| 20 23 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
            require  | 
| 24 | 
            -
            require ' | 
| 25 | 
            -
            require ' | 
| 26 | 
            -
            require ' | 
| 24 | 
            +
            # The reason these files have such terrible names is so they don't conflict with
         | 
| 25 | 
            +
            # files in Rails's app/models directory; Rails seems to prefer loading those
         | 
| 26 | 
            +
            # when require is called.
         | 
| 27 | 
            +
            require 'scribdmultiparthack'
         | 
| 28 | 
            +
            require 'scribderrors'
         | 
| 29 | 
            +
            require 'scribdapi'
         | 
| 30 | 
            +
            require 'scribdresource'
         | 
| 31 | 
            +
            require 'scribddoc'
         | 
| 32 | 
            +
            require 'scribduser'
         | 
    
        data/lib/{api.rb → scribdapi.rb}
    RENAMED
    
    
    
        data/lib/{doc.rb → scribddoc.rb}
    RENAMED
    
    | @@ -78,10 +78,10 @@ module Scribd | |
| 78 78 | 
             
                # process called _revisioning_.
         | 
| 79 79 | 
             
                #
         | 
| 80 80 | 
             
                # This method can throw a +Timeout+ exception if the connection is slow or
         | 
| 81 | 
            -
                # inaccessible. A ResponseError will be thrown if a remote problem | 
| 82 | 
            -
                # A PrivilegeError will be thrown if you try to upload a new | 
| 83 | 
            -
                # document with no associated user (i.e., one retrieved from | 
| 84 | 
            -
                # method).
         | 
| 81 | 
            +
                # inaccessible. A Scribd::ResponseError will be thrown if a remote problem
         | 
| 82 | 
            +
                # occurs. A Scribd::PrivilegeError will be thrown if you try to upload a new
         | 
| 83 | 
            +
                # revision for a document with no associated user (i.e., one retrieved from
         | 
| 84 | 
            +
                # the find method).
         | 
| 85 85 | 
             
                #
         | 
| 86 86 | 
             
                # You must specify the +type+ attribute alongside the +file+ attribute if
         | 
| 87 87 | 
             
                # the file's type cannot be determined from its name.
         | 
| @@ -11,9 +11,9 @@ module Scribd | |
| 11 11 | 
             
              # Raised when trying to perform an action that isn't allowed for the current
         | 
| 12 12 | 
             
              # active user. Note that this exception is thrown only if the error originates
         | 
| 13 13 | 
             
              # locally. If the request must go out to the Scribd server before the
         | 
| 14 | 
            -
              # privilege error occurs, a ResponseError will be thrown. Unless a | 
| 15 | 
            -
              # documentation indicates otherwise, assume that the error will | 
| 16 | 
            -
              # remotely and a ResponseError will be thrown.
         | 
| 14 | 
            +
              # privilege error occurs, a Scribd::ResponseError will be thrown. Unless a
         | 
| 15 | 
            +
              # method's documentation indicates otherwise, assume that the error will
         | 
| 16 | 
            +
              # originate remotely and a Scribd::ResponseError will be thrown.
         | 
| 17 17 |  | 
| 18 18 | 
             
              class PrivilegeError < StandardError; end
         | 
| 19 19 |  | 
| @@ -22,7 +22,8 @@ module Scribd | |
| 22 22 | 
             
              # their descriptions for each API method.
         | 
| 23 23 |  | 
| 24 24 | 
             
              class ResponseError < RuntimeError
         | 
| 25 | 
            -
                 | 
| 25 | 
            +
                # The error code.
         | 
| 26 | 
            +
                attr_reader :code
         | 
| 26 27 |  | 
| 27 28 | 
             
                # Initializes the error with a given code.
         | 
| 28 29 |  | 
| @@ -30,4 +31,4 @@ module Scribd | |
| 30 31 | 
             
                  @code = code
         | 
| 31 32 | 
             
                end
         | 
| 32 33 | 
             
              end
         | 
| 33 | 
            -
            end
         | 
| 34 | 
            +
            end
         | 
| @@ -1,12 +1,13 @@ | |
| 1 | 
            +
            # This is based on a great snippet from Pivot Labs, used with permission:
         | 
| 2 | 
            +
            # http://pivots.pivotallabs.com/users/damon/blog/articles/227-standup-04-27-07-testing-file-uploads
         | 
| 3 | 
            +
             | 
| 1 4 | 
             
            require 'net/https'
         | 
| 2 5 | 
             
            require "rubygems"
         | 
| 3 6 | 
             
            require "mime/types" # Requires gem install mime-types
         | 
| 4 7 | 
             
            require "base64"
         | 
| 5 8 | 
             
            require 'cgi'
         | 
| 6 9 |  | 
| 7 | 
            -
             | 
| 8 | 
            -
            # http://pivots.pivotallabs.com/users/damon/blog/articles/227-standup-04-27-07-testing-file-uploads
         | 
| 9 | 
            -
            module Net #:nodoc:
         | 
| 10 | 
            +
            module Net #:nodoc:all
         | 
| 10 11 | 
             
              class HTTP::Post
         | 
| 11 12 | 
             
                def multipart_params=(param_hash={})
         | 
| 12 13 | 
             
                  boundary_token = [Array.new(8) {rand(256)}].join
         | 
| @@ -36,4 +37,4 @@ module Net #:nodoc: | |
| 36 37 | 
             
                  "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n#{value}\r\n"
         | 
| 37 38 | 
             
                end
         | 
| 38 39 | 
             
              end
         | 
| 39 | 
            -
            end
         | 
| 40 | 
            +
            end
         | 
| @@ -121,7 +121,7 @@ module Scribd | |
| 121 121 | 
             
                #  doc.save
         | 
| 122 122 | 
             
                #  doc.foobar #=> Returns nil
         | 
| 123 123 | 
             
                #
         | 
| 124 | 
            -
                # Because of this, no Scribd resource will ever raise  | 
| 124 | 
            +
                # Because of this, no Scribd resource will ever raise NoMethodError.
         | 
| 125 125 |  | 
| 126 126 | 
             
                def method_missing(meth, *args)
         | 
| 127 127 | 
             
                  if meth.to_s =~ /(\w+)=/ then
         | 
| @@ -155,4 +155,4 @@ module Scribd | |
| 155 155 | 
             
                  end
         | 
| 156 156 | 
             
                end
         | 
| 157 157 | 
             
              end
         | 
| 158 | 
            -
            end
         | 
| 158 | 
            +
            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.0. | 
| 4 | 
            +
              version: 0.0.4
         | 
| 5 5 | 
             
            platform: ""
         | 
| 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-02- | 
| 12 | 
            +
            date: 2008-02-20 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 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 31 31 | 
             
                    version: 1.5.0
         | 
| 32 32 | 
             
                version: 
         | 
| 33 | 
            -
            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.  == FEATURES | 
| 33 | 
            +
            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/platform  == 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"
         | 
| 34 34 | 
             
            email: api@scribd.com
         | 
| 35 35 | 
             
            executables: []
         | 
| 36 36 |  | 
| @@ -46,13 +46,13 @@ files: | |
| 46 46 | 
             
            - Manifest.txt
         | 
| 47 47 | 
             
            - README.txt
         | 
| 48 48 | 
             
            - Rakefile
         | 
| 49 | 
            -
            - lib/ | 
| 50 | 
            -
            - lib/ | 
| 51 | 
            -
            - lib/ | 
| 52 | 
            -
            - lib/ | 
| 53 | 
            -
            - lib/ | 
| 49 | 
            +
            - lib/scribdapi.rb
         | 
| 50 | 
            +
            - lib/scribddoc.rb
         | 
| 51 | 
            +
            - lib/scribderrors.rb
         | 
| 52 | 
            +
            - lib/scribdmultiparthack.rb
         | 
| 53 | 
            +
            - lib/scribdresource.rb
         | 
| 54 54 | 
             
            - lib/rscribd.rb
         | 
| 55 | 
            -
            - lib/ | 
| 55 | 
            +
            - lib/scribduser.rb
         | 
| 56 56 | 
             
            - sample/01_upload.rb
         | 
| 57 57 | 
             
            - sample/02_user.rb
         | 
| 58 58 | 
             
            - sample/test.txt
         |