Class: Myun2::TwitterShell::Authorize
- Inherits:
-
Object
- Object
- Myun2::TwitterShell::Authorize
- Defined in:
- lib/myun2/twitter_shell/authorize.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#pin ⇒ Object
readonly
Returns the value of attribute pin.
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize ⇒ Authorize
constructor
A new instance of Authorize.
- #read_pin ⇒ Object
- #request_authorize_url ⇒ Object
Constructor Details
#initialize ⇒ Authorize
Returns a new instance of Authorize.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/myun2/twitter_shell/authorize.rb', line 8 def initialize puts "* Requesting authorization URL ..." auth_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 && end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
6 7 8 |
# File 'lib/myun2/twitter_shell/authorize.rb', line 6 def access_token @access_token end |
#pin ⇒ Object (readonly)
Returns the value of attribute pin.
6 7 8 |
# File 'lib/myun2/twitter_shell/authorize.rb', line 6 def pin @pin end |
Instance Method Details
#authorize ⇒ Object
30 31 32 |
# File 'lib/myun2/twitter_shell/authorize.rb', line 30 def @access_token = @auth.(@pin) end |
#read_pin ⇒ Object
26 27 28 |
# File 'lib/myun2/twitter_shell/authorize.rb', line 26 def read_pin @pin = gets.chomp end |
#request_authorize_url ⇒ Object
19 20 21 22 23 24 |
# File 'lib/myun2/twitter_shell/authorize.rb', line 19 def @auth = Myun2::Twitter::Authenticate.new( consumer_key: ConsumerKey::KEY, consumer_secret: ConsumerKey::SECRET) @auth. end |