Class: DependencyProxy::RequestTokenService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- DependencyProxy::RequestTokenService
- Defined in:
- app/services/dependency_proxy/request_token_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(image) ⇒ RequestTokenService
constructor
A new instance of RequestTokenService.
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(image) ⇒ RequestTokenService
Returns a new instance of RequestTokenService.
5 6 7 |
# File 'app/services/dependency_proxy/request_token_service.rb', line 5 def initialize(image) @image = image end |
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/dependency_proxy/request_token_service.rb', line 9 def execute response = Gitlab::HTTP.get(auth_url) if response.success? success(token: Gitlab::Json.parse(response.body)['token']) else error('Expected 200 response code for an access token', response.code) end rescue Timeout::Error => exception error(exception., 599) rescue JSON::ParserError error('Failed to parse a response body for an access token', 500) end |