Class: Ci::AuthJobFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/ci/auth_job_finder.rb

Constant Summary collapse

AuthError =
Class.new(StandardError)
NotRunningJobError =
Class.new(AuthError)
ErasedJobError =
Class.new(AuthError)
DeletedProjectError =
Class.new(AuthError)

Instance Method Summary collapse

Constructor Details

#initialize(token:) ⇒ AuthJobFinder

Returns a new instance of AuthJobFinder.


9
10
11
# File 'app/finders/ci/auth_job_finder.rb', line 9

def initialize(token:)
  @token = token
end

Instance Method Details

#executeObject


21
22
23
24
# File 'app/finders/ci/auth_job_finder.rb', line 21

def execute
  execute!
rescue AuthError
end

#execute!Object


13
14
15
16
17
18
19
# File 'app/finders/ci/auth_job_finder.rb', line 13

def execute!
  find_job_by_token.tap do |job|
    next unless job

    validate_job!(job)
  end
end