You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

twitter-register 766B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env ruby
  2. require 'cross-post'
  3. require 'twitter'
  4. require 'oauth'
  5. require 'launchy'
  6. require 'awesome_print'
  7. config = CrossPost::Config.new
  8. settings = config[:settings]
  9. consumer_key = settings['twitter.consumer.key']
  10. consumer_secret = settings['twitter.consumer.secret']
  11. client = OAuth::Consumer.new consumer_key,
  12. consumer_secret,
  13. site: Twitter::REST::Client::BASE_URL
  14. request_token = client.get_request_token
  15. url = request_token.authorize_url
  16. puts url
  17. begin
  18. Launchy.open url
  19. rescue
  20. end
  21. print 'PIN ? '
  22. pin = gets.chomp
  23. access_token = request_token.get_access_token oauth_verifier: pin
  24. settings['twitter.access.token'] = access_token.token
  25. settings['twitter.access.secret'] = access_token.secret
  26. settings.save