Class: Stackify::AuthWorker

Inherits:
Worker show all
Defined in:
lib/stackify/workers/auth_worker.rb

Instance Attribute Summary

Attributes inherited from Worker

#name, #type

Instance Method Summary collapse

Methods inherited from Worker

#alive?, #async_perform, #backtrace, #id, #perform, #shutdown!, #status

Constructor Details

#initialize(name = 'Authorisation worker') ⇒ AuthWorker

Returns a new instance of AuthWorker.



4
5
6
7
# File 'lib/stackify/workers/auth_worker.rb', line 4

def initialize name = 'Authorisation worker'
  super
  @type = :auth
end

Instance Method Details

#after_perform(result) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/stackify/workers/auth_worker.rb', line 9

def after_perform result
  if result.try(:status) == 200
    Stackify.send :authorized!
    Stackify.successfull_authorisation result
  else
    Stackify.unsuccessfull_authorisation result, self
  end
end