Class: Git::Semaphore::API::Enrich

Inherits:
Object
  • Object
show all
Defined in:
lib/git/semaphore/api_enrich.rb

Class Method Summary collapse

Class Method Details

.history(project_hash_id, branch_id) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/git/semaphore/api_enrich.rb', line 17

def self.history(project_hash_id, branch_id)
  API.history(project_hash_id, branch_id).tap do |history|
    history['builds'].each do |build|
      enrich(build)
    end
  end
end

.projectsObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/git/semaphore/api_enrich.rb', line 6

def self.projects
  API.projects.tap do |results|
    results.each do |project|
      # full repository name on github.com: 'pvdb/git-semaphore'
      project['full_name']  = [project['owner'], project['name']].join('/')
      # https://semaphoreci.com/pvdb/git-semaphore -> https://github.com/pvdb/git-semaphore
      project['github_url'] = project['html_url'].sub(/semaphoreci\.com/, 'github.com')
    end
  end
end

.status(project_hash_id, branch_id) ⇒ Object



25
26
27
28
29
# File 'lib/git/semaphore/api_enrich.rb', line 25

def self.status(project_hash_id, branch_id)
  API.status(project_hash_id, branch_id).tap do |status|
    enrich(status)
  end
end