Class: Sredder::WrikeAuth
- Inherits:
-
Object
- Object
- Sredder::WrikeAuth
- Extended by:
- Forwardable
- Defined in:
- lib/sredder/wrike_auth.rb
Instance Attribute Summary collapse
-
#consumer ⇒ Object
writeonly
Sets the attribute consumer.
-
#sredderc ⇒ Object
Returns the value of attribute sredderc.
Instance Method Summary collapse
- #authorized? ⇒ Boolean
-
#initialize(sredderc = Sredderc.new) ⇒ WrikeAuth
constructor
A new instance of WrikeAuth.
- #oauth_access_token ⇒ Object
- #run_oauth_procedure ⇒ Object
Constructor Details
Instance Attribute Details
#consumer=(value) ⇒ Object
Sets the attribute consumer
18 19 20 |
# File 'lib/sredder/wrike_auth.rb', line 18 def consumer=(value) @consumer = value end |
#sredderc ⇒ Object
Returns the value of attribute sredderc.
17 18 19 |
# File 'lib/sredder/wrike_auth.rb', line 17 def sredderc @sredderc end |
Instance Method Details
#authorized? ⇒ Boolean
41 42 43 |
# File 'lib/sredder/wrike_auth.rb', line 41 def !!credentials[:wrike_token] && !!credentials[:wrike_secret] end |
#oauth_access_token ⇒ Object
45 46 47 48 49 |
# File 'lib/sredder/wrike_auth.rb', line 45 def oauth_access_token if @access_token || @access_token ||= OAuth::AccessToken.new(consumer, credentials[:wrike_token], credentials[:wrike_secret]) end end |
#run_oauth_procedure ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sredder/wrike_auth.rb', line 27 def run_oauth_procedure @request_token = consumer.get_request_token puts 'Sredder is about to open your browser to complete the oauth protocol.' puts 'Please return to the terminal after you authenticate with Wrike.' Util.wait_for_input `open #{@request_token.}` Util.wait_for_input store_tokens(@request_token.get_access_token) end |