look-bitly-api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bitly-api.gemspec +1 -1
- data/lib/bitly-api.rb +2 -1
- data/lib/bitly-api/bitly-api.rb +2 -1
- metadata +1 -1
data/bitly-api.gemspec
CHANGED
data/lib/bitly-api.rb
CHANGED
data/lib/bitly-api/bitly-api.rb
CHANGED
@@ -17,8 +17,9 @@ module BitlyApi
|
|
17
17
|
@httpclient = HTTPClient.new
|
18
18
|
end
|
19
19
|
|
20
|
+
# shorten +long_url+. +long_url+ is CGI escaped, so you shouldn't escape it yourself.
|
20
21
|
def shorten(long_url)
|
21
|
-
http_response = @httpclient.get_content(build_url("shorten", "longUrl=#{long_url}"))
|
22
|
+
http_response = @httpclient.get_content(build_url("shorten", "longUrl=#{CGI::escape(long_url)}"))
|
22
23
|
data = JSON.parse(http_response)
|
23
24
|
raise BitlyError.new(data["errorMessage"]) unless data["statusCode"] == "OK"
|
24
25
|
data["results"][long_url]
|