class Myun2::TwitterShell::Authorize

Attributes

access_token[R]
pin[R]

Public Class Methods

new() click to toggle source
# File lib/myun2/twitter_shell/authorize.rb, line 8
def initialize
  puts "* Requesting authorization URL ..."
  auth_url = request_authorize_url
  puts "  " + auth_url
  puts "* Please access to above URL in your browser."
  puts "  And permit application 'Myun2 Twitter Shell (Twsh)."
  puts "  And enter shown PIN code to under."
  print "PIN> "
  read_pin && authorize
end

Public Instance Methods

authorize() click to toggle source
# File lib/myun2/twitter_shell/authorize.rb, line 30
def authorize
  @access_token = @auth.authorize(@pin)
end
read_pin() click to toggle source
# File lib/myun2/twitter_shell/authorize.rb, line 26
def read_pin
  @pin = gets.chomp
end
request_authorize_url() click to toggle source
# File lib/myun2/twitter_shell/authorize.rb, line 19
def request_authorize_url
  @auth = Myun2::Twitter::Authenticate.new(
    consumer_key: ConsumerKey::KEY,
    consumer_secret: ConsumerKey::SECRET)
  @auth.request_authorize_url
end