Bitly API

I created a small and simple library to access the bitly API.

Usage is simple:

>> api = BitlyApi::Bitly.new(:login => BITLY_LOGIN, :api_key => BITLY_API_KEY)
=> #<BitlyApi::Bitly:0x7f93177c87e0 @api_version="2.0.1", @api_key=BITLY_API_KEY, @login=BITLY_LOGIN>
>> api.shorten "http://pickhost.eu"
=> {"userHash"=>"2wzb4d", "hash"=>"zNgN6", "shortKeywordUrl"=>"", "shortUrl"=>"http://bit.ly/2wzb4d"}
>> api.expand "2wzb4d"
=> {"longUrl"=>"http://pickhost.eu/"}
>> api.stats "2wzb4d"
=> {"userClicks"=>1, "referrers"=>{""=>{"direct"=>1}}, "userHash"=>"2wzb4d", "hash"=>"zNgN6", "clicks"=>1, "userReferrers"=>{""=>{"direct"=>1}}}
>> api.info "2wzb4d"
=> {"thumbnail"=>{"small"=>"http://s.bit.ly/bitly/zNgN6/thumbnail_small.png", "medium"=>"http://s.bit.ly/bitly/zNgN6/thumbnail_medium.png", "large"=>"http://s.bit.ly/bitly/zNgN6/thumbnail_large.png"}, "id3"=>{}, "userHash"=>"2wzb4d", "hash"=>"zNgN6", "mirrorUrl"=>"", "htmlMetaDescription"=>"An image hosting service with simplicity and speed in mind.", "version"=>1.0, "htmlTitle"=>"Pic(k)host :: Upload your Images!", "globalHash"=>"zNgN6", "calaisId"=>"", "calais"=>{}, "users"=>["pickhost"], "surbl"=>0, "longUrl"=>"http://pickhost.eu/", "htmlMetaKeywords"=>["Bilder hochladen", "Bilder upload", "Foto upload", "Bilderhoster", "Imagehoster", "Foto", "Bild", "Photo", "Image", "Pic", "Hoster"], "contentType"=>"text/html; charset=utf-8", "keyword"=>"", "exif"=>{}, "contentLength"=>"", "shortenedByUser"=>"pickhost", "metacarta"=>[], "keywords"=>[], "calaisResolutions"=>{}}

The project is located at GitHub.

comments powered by Disqus