Module: Gerry::Client::Projects

Included in:
Gerry::Client
Defined in:
lib/gerry/client/projects.rb

Instance Method Summary collapse

Instance Method Details

#find_project(name) ⇒ Hash

Get the projects that start with the specified prefix and accessible by the caller.

Parameters:

  • name (String)

    the project name.

Returns:

  • (Hash)

    the projects.



16
17
18
# File 'lib/gerry/client/projects.rb', line 16

def find_project(name)
  get("/projects/#{name}")
end

#get_head(project) ⇒ String

Get the symbolic HEAD ref for the specified project.

Parameters:

  • project (String)

    the project name.

Returns:

  • (String)

    the current ref to which HEAD points to.



24
25
26
# File 'lib/gerry/client/projects.rb', line 24

def get_head(project)
  get("/projects/#{project}/HEAD")
end

#projectsHash

Get the projects accessible by the caller.

Returns:

  • (Hash)

    the projects.



7
8
9
# File 'lib/gerry/client/projects.rb', line 7

def projects
  get('/projects/')
end

#set_head(project, branch) ⇒ String

Set the symbolic HEAD ref for the specified project to point to the specified branch.

Parameters:

  • project (String)

    the project name.

  • branch (String)

    the branch to point to.

Returns:

  • (String)

    the new ref to which HEAD points to.



34
35
36
37
38
39
40
# File 'lib/gerry/client/projects.rb', line 34

def set_head(project, branch)
  url = "/projects/#{project}/HEAD"
  body = {
    ref: 'refs/heads/' + branch
  }
  put(url, body)
end