class Git::Semaphore::API

Public Class Methods

branches(project_hash_id) click to toggle source
# File lib/git/semaphore/api.rb, line 9
def self.branches(project_hash_id)
  get_json branches_uri(project_hash_id)
end
get_json(uri) click to toggle source

private helper functions

# File lib/git/semaphore/api.rb, line 37
def self.get_json(uri)
  @client ||= SemaphoreCI::API::V1.new(Git::Semaphore.auth_token)
  @client.get(uri)
end
history(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api.rb, line 17
def self.history(project_hash_id, branch_id)
  get_json history_uri(project_hash_id, branch_id)
end
information(project_hash_id, branch_id, build_number) click to toggle source
# File lib/git/semaphore/api.rb, line 21
def self.information(project_hash_id, branch_id, build_number)
  get_json information_uri(project_hash_id, branch_id, build_number)
end
log(project_hash_id, branch_id, build_number) click to toggle source
# File lib/git/semaphore/api.rb, line 25
def self.log(project_hash_id, branch_id, build_number)
  get_json log_uri(project_hash_id, branch_id, build_number)
end
projects() click to toggle source
# File lib/git/semaphore/api.rb, line 5
def self.projects
  get_json projects_uri
end
rebuild(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api.rb, line 29
def self.rebuild(project_hash_id, branch_id)
  get_json last_revision_uri(project_hash_id, branch_id), :post
end
status(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api.rb, line 13
def self.status(project_hash_id, branch_id)
  get_json status_uri(project_hash_id, branch_id)
end

Private Class Methods

branches_uri(project_hash_id) click to toggle source
# File lib/git/semaphore/api.rb, line 50
def self.branches_uri(project_hash_id)
  # https://semaphoreci.com/docs/branches-and-builds-api.html#project_branches
  # GET /api/v1/projects/:hash_id/branches
  File.join('/projects', project_hash_id, 'branches')
end
history_uri(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api.rb, line 66
def self.history_uri(project_hash_id, branch_id)
  # https://semaphoreci.com/docs/branches-and-builds-api.html#branch_history
  # GET /api/v1/projects/:hash_id/:id
  File.join('/projects', project_hash_id, branch_id)
end
information_uri(project_hash_id, branch_id, build_number) click to toggle source
# File lib/git/semaphore/api.rb, line 74
def self.information_uri(project_hash_id, branch_id, build_number)
  # https://semaphoreci.com/docs/branches-and-builds-api.html#build_information
  # GET /api/v1/projects/:hash_id/:id/builds/:number
  File.join('/projects', project_hash_id, branch_id, 'builds', build_number)
end
last_revision_uri(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api.rb, line 90
def self.last_revision_uri(project_hash_id, branch_id)
  # https://semaphoreci.com/docs/branches-and-builds-api.html#rebuild
  # POST /api/v1/projects/:project_hash_id/:branch_id/build
  File.join('/projects', project_hash_id, branch_id, 'build')
end
log_uri(project_hash_id, branch_id, build_number) click to toggle source
# File lib/git/semaphore/api.rb, line 82
def self.log_uri(project_hash_id, branch_id, build_number)
  # https://semaphoreci.com/docs/branches-and-builds-api.html#build_log
  # GET /api/v1/projects/:hash_id/:id/builds/:number/log
  File.join('/projects', project_hash_id, branch_id, 'builds', build_number, 'log')
end
projects_uri() click to toggle source
# File lib/git/semaphore/api.rb, line 42
def self.projects_uri
  # https://semaphoreci.com/docs/projects-api.html
  # GET /api/v1/projects
  File.join('/projects')
end
status_uri(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api.rb, line 58
def self.status_uri(project_hash_id, branch_id)
  # https://semaphoreci.com/docs/branches-and-builds-api.html#branch_status
  # GET /api/v1/projects/:hash_id/:id/status
  File.join('/projects', project_hash_id, branch_id, 'status')
end