Skip to content

Commit

Permalink
Cleaning a bit on su.pr
Browse files Browse the repository at this point in the history
  • Loading branch information
drcapulet committed Nov 23, 2009
1 parent 28f3df7 commit cb66881
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 1 addition & 5 deletions lib/shorty/supr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ def self.raise_error(hash)
end

def self.handle_full_or_hash_option(short, url, full)
if full
short["errorCode"].zero? ? short["results"][url]["shortUrl"] : self.raise_error(short)
else
short["errorCode"].zero? ? short["results"][url]["hash"] : self.raise_error(short)
end
short["errorCode"].zero? ? (full ? short["results"][url]["shortUrl"] : short["results"][url]["hash"]) : self.raise_error(short)
end

def self.prep_shorten_request(url)
Expand Down
4 changes: 4 additions & 0 deletions test/supr_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class SuprTest < Test::Unit::TestCase
should "return a shortened url" do
assert_equal 'http://su.pr/2yw2PP', Shorty::Supr.shorten('http://cnn.com')
end

should "return a shortened hash" do
assert_equal '2yw2PP', Shorty::Supr.shorten('http://cnn.com', false)
end

should "return an expanded url when passed a hash" do
assert_equal 'http://cnn.com/', Shorty::Supr.expand('2yw2PP')
Expand Down

0 comments on commit cb66881

Please sign in to comment.