ruby on rails - I'm getting this output: #<Bitly::V3::Url:0x202ea38> instead of the shortened URL -


i using bitly gem in rails 3 trying post url in shortened form twitter

my gemfile

gem "bitly", :git => 'https://github.com/philnash/bitly/' gem 'omniauth-bitly', :git => 'https://github.com/michaeldelorenzo/omniauth-bitly.git' 

config\initializers\bitly.rb

bitly.configure |config|   config.api_version = 3   config.login = "username"   config.api_key = "x_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" end 

i'm using use bitly

      bitly.use_api_version_3       bitly = bitly.client       bitly.shorten("http://domain.com/articles/#{id}") 

but when check on twitter, output

#<bitly::v3::url:0x202ea38> 

how preventing shortened url form show?

when log account on bitly, see worked , shows conversions there... url not posted twitter

this example gems documentation

u = bitly.shorten('http://www.google.com') #=> bitly::url  u.long_url #=> "http://www.google.com" u.short_url #=> "http://bit.ly/ywd1" u.bitly_url #=> "http://bit.ly/ywd1" u.jmp_url #=> "http://j.mp/ywd1" u.user_hash #=> "ywd1" u.hash #=> "2v6cfi" u.info #=> ruby hash of json returned api u.stats #=> ruby hash of json returned api 

based on result expected. if want short url try

bitly.shorten("http://domain.com/articles/#{id}").short_url 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -