class SingularityClient::API

Handles the singularity api

Public Class Methods

add(config, repo, project, type) click to toggle source

Add to the singularity config the ‘type’ parameter can be pull_request or push

# File lib/singularity_client/api.rb, line 24
def self.add(config, repo, project, type)
  unless type == 'proposal' || type == 'change'
    fail("ERROR invalid type: #{type}. \
          Valid types are \'proposal\' or \'change\'")
  end

  endpoint = "config/#{type}"
  post_data = {
    repository: "#{config.organization}/#{repo}",
    project: project
  }

  request = SingularityClient::Request.new(config)
  request.post(endpoint, post_data)

  puts('success!')
end
remove(config, repo) click to toggle source

Remove a repository from the singularity config

# File lib/singularity_client/api.rb, line 45
def self.remove(config, repo)
  endpoint = 'config/repo'

  post_data = {
    repository: "#{config.organization}/#{repo}"
  }

  request = SingularityClient::Request.new(config)
  request.delete(endpoint, post_data)

  puts('success!')
end