Class: Runkeeper::AuthorizationServer::App
- Inherits:
-
Object
- Object
- Runkeeper::AuthorizationServer::App
- Defined in:
- lib/runkeeper/token_generator.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(server) ⇒ App
constructor
A new instance of App.
- #params ⇒ Object
Constructor Details
#initialize(server) ⇒ App
Returns a new instance of App.
13 14 15 |
# File 'lib/runkeeper/token_generator.rb', line 13 def initialize(server) @server = server end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
11 12 13 |
# File 'lib/runkeeper/token_generator.rb', line 11 def code @code end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
11 12 13 |
# File 'lib/runkeeper/token_generator.rb', line 11 def env @env end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
11 12 13 |
# File 'lib/runkeeper/token_generator.rb', line 11 def server @server end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/runkeeper/token_generator.rb', line 17 def call(env) @env = env if params['code'] @code = params['code'] [200, { 'Content-Type' => 'text/html' }, ['Check the console for your token.']] else [404, { 'Content-Type' => 'text/html' }, ['']] end end |
#params ⇒ Object
27 28 29 30 31 32 |
# File 'lib/runkeeper/token_generator.rb', line 27 def params @params ||= begin ary = env['QUERY_STRING'].split('&').map {|s| s.split('=', 2)} Hash[*ary.flatten] end end |