Class: BackupRepos::BackupGitlabEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/backup_repos/backup_gitlab_endpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ BackupGitlabEndpoint

Returns a new instance of BackupGitlabEndpoint.



10
11
12
13
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 10

def initialize(settings)
  @endpoint = settings.endpoint
  @private_token = settings.private_token
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



8
9
10
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 8

def endpoint
  @endpoint
end

#private_tokenObject (readonly)

Returns the value of attribute private_token.



8
9
10
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 8

def private_token
  @private_token
end

Instance Method Details

#callObject



15
16
17
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 15

def call
  backup_repositories
end

#clientObject



23
24
25
26
27
28
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 23

def client
  @client ||= ::Gitlab.client(
    private_token: private_token,
    endpoint: endpoint
  )
end

#endpoint_hostObject



30
31
32
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 30

def endpoint_host
  @endpoint_host ||= URI.parse(endpoint).host
end

#reposObject



19
20
21
# File 'lib/backup_repos/backup_gitlab_endpoint.rb', line 19

def repos
  @repos ||= client.projects.auto_paginate
end