travis-api/lib/travis/services/find_repo_settings.rb
Aakriti Gupta c6a1eda572 Move travis-core files from /vendor to /lib.
- Re-factor
- Remove code for notifications
- Remove addons
- Remove travis-core gem.
- Ignore logs directory only
- Move core tests to spec/lib
2016-07-28 15:09:08 +02:00

32 lines
569 B
Ruby

require 'travis/services/base'
module Travis
module Services
class FindRepoSettings < Base
register :find_repo_settings
def run(options = {})
result if repo && authorized?
end
def updated_at
result.try(:updated_at)
end
def authorized?
current_user && current_user.permission?(:push, :repository_id => repo.id)
end
private
def repo
@repo ||= run_service(:find_repo, params)
end
def result
repo.settings if repo
end
end
end
end