lib/bitly/client.rb in philnash-bitly-0.1.2 vs lib/bitly/client.rb in philnash-bitly-0.1.4

- old
+ new

@@ -4,12 +4,10 @@ require 'json' module Bitly API_URL = 'http://api.bit.ly/' API_VERSION = '2.0.1' - # login = 'philnash' - # api_key = 'R_7776acc394294b2b0ad2c261a91c483d' def self.new(login, api_key) Bitly::Client.new(login,api_key) end @@ -28,10 +26,10 @@ result = get_result(request) result = {:long_url => input}.merge result[input] Bitly::Url.new(@login,@api_key,result) elsif input.is_a? Array request = create_url "shorten" - request.query << "&" + input.map { |long_url| "longUrl=#{URI.encode(long_url)}" }.join("&") unless input.nil? + request.query << "&" + input.map { |long_url| "longUrl=#{CGI.escape(long_url)}" }.join("&") unless input.nil? result = get_result(request) input.map do |long_url| new_url = {:long_url => long_url}.merge result[long_url] long_url = Bitly::Url.new(@login,@api_key,new_url) end \ No newline at end of file