Class: Robin::Actions::Authenticate
- Inherits:
-
Object
- Object
- Robin::Actions::Authenticate
- Defined in:
- lib/robin/actions/authenticate.rb
Instance Method Summary collapse
- #execute(client, output, input) ⇒ Object
- #failed ⇒ Object
- #instructions(url) ⇒ Object
- #success ⇒ Object
Instance Method Details
#execute(client, output, input) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/robin/actions/authenticate.rb', line 5 def execute(client, output, input) output.print instructions(PinAuthenticator.) pin = input.gets.chomp if PinAuthenticator.authenticate(pin) output.puts success else output.puts failed end end |
#failed ⇒ Object
34 35 36 |
# File 'lib/robin/actions/authenticate.rb', line 34 def failed "Pin was incorrect" end |
#instructions(url) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/robin/actions/authenticate.rb', line 15 def instructions(url) instructions = "In order to use Robin you need to authenticate with your Twitter account.\nTo do this, first, point your browser to the following URL:\n\n\#{url}\n\nLog in if required. \nYou must now authorize the app and type the given PIN.\n\nPIN >> \n" instructions.chomp end |
#success ⇒ Object
30 31 32 |
# File 'lib/robin/actions/authenticate.rb', line 30 def success "Great. You can now use Robin." end |