Class: BackupRepos::BackupGitlabEndpoint
- Defined in:
- lib/backup_repos/backup_gitlab_endpoint.rb
Constant Summary collapse
- DEFAULT_ENDPOINT =
'https://gitlab.com/api/v4'
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#private_token ⇒ Object
readonly
Returns the value of attribute private_token.
Instance Method Summary collapse
- #call ⇒ Object
- #client ⇒ Object
- #endpoint_host ⇒ Object
-
#initialize(settings) ⇒ BackupGitlabEndpoint
constructor
A new instance of BackupGitlabEndpoint.
- #repos ⇒ Object
Constructor Details
#initialize(settings) ⇒ BackupGitlabEndpoint
14 15 16 17 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 14 def initialize(settings) @endpoint = settings.endpoint || DEFAULT_ENDPOINT @private_token = settings.private_token end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
12 13 14 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 12 def endpoint @endpoint end |
#private_token ⇒ Object (readonly)
Returns the value of attribute private_token.
12 13 14 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 12 def private_token @private_token end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 19 def call backup_repositories end |
#client ⇒ Object
27 28 29 30 31 32 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 27 def client @client ||= ::Gitlab.client( private_token: private_token, endpoint: endpoint ) end |
#endpoint_host ⇒ Object
34 35 36 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 34 def endpoint_host @endpoint_host ||= URI.parse(endpoint).host end |
#repos ⇒ Object
23 24 25 |
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 23 def repos @repos ||= client.projects(membership: true).auto_paginate end |