Permalink
Browse files

fix an authorization bug when the credentials are wrong

  • Loading branch information...
1 parent 9597972 commit 9f1980526e1d97f3f7be11d607048b445b66d557 @dakrone committed Jul 7, 2010
Showing with 14 additions and 10 deletions.
  1. +1 −1 VERSION
  2. +11 −7 lib/ricepaper.rb
  3. +2 −2 ricepaper.gemspec
View
@@ -1 +1 @@
-0.0.3
+0.0.4
View
@@ -24,13 +24,17 @@ def initialize(username, password, apiurl = "https://www.instapaper.com/api/")
# Handle Errors - sets the error code appropriately
# so that it can be reported
def handle_error(err)
- result = /(\d+)/.match(err.to_s)[1]
- @error = case result
- when "400" then "Bad Request"
- when "403" then "Invalid username of password"
- when "500" then "There was a server error. Please try again later."
- else "An unknown error occured"
- end
+ if err.to_s == "Forbidden"
+ @error = "Invalid username or password"
+ else
+ result = /(\d+)/.match(err.to_s)[1]
+ @error = case result
+ when "400" then "Bad Request"
+ when "403" then "Invalid username or password"
+ when "500" then "There was a server error. Please try again later."
+ else "An unknown error occured"
+ end
+ end
end
# Authenticate with instapaper, returning true if auth
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{ricepaper}
- s.version = "0.0.3"
+ s.version = "0.0.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Lee Hinman"]
- s.date = %q{2010-07-01}
+ s.date = %q{2010-07-06}
s.default_executable = %q{ricepaper}
s.description = %q{Ricepaper is a library that allows you to add URLs to Instapaper, either by using it as a CLI or as a Ruby library.}
s.email = %q{lee@writequit.org}

0 comments on commit 9f19805

Please sign in to comment.