class LabClient::Projects

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Projects Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Users Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Specifics

Public Instance Methods

access_requests() click to toggle source
# File lib/labclient/projects/access_requests/client.rb, line 13
def access_requests
  ProjectAccessRequests.new(client)
end
archive(project_id) click to toggle source
# File lib/labclient/projects/archive.rb, line 19
def archive(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/archive", Project)
end
badges() click to toggle source
# File lib/labclient/projects/badges/client.rb, line 13
def badges
  ProjectBadges.new(client)
end
clusters() click to toggle source
# File lib/labclient/projects/clusters/client.rb, line 13
def clusters
  ProjectClusters.new(client)
end
create(query = {}) click to toggle source

TODO: Test Project/Group Creation TODO: Create helper for group

# File lib/labclient/projects/create.rb, line 57
def create(query = {})
  format_query_id(:namespace_id, query)
  client.request(:post, 'projects', Project, query)
end
create_for_user(user_id, query = {}) click to toggle source
# File lib/labclient/projects/create.rb, line 51
def create_for_user(user_id, query = {})
  client.request(:post, "projects/user/#{user_id}", Project, query)
end
delete(project_id) click to toggle source
# File lib/labclient/projects/delete.rb, line 19
def delete(project_id)
  project_id = format_id(project_id)

  client.request(:delete, "projects/#{project_id}")
end
deployments() click to toggle source
# File lib/labclient/projects/deployments/client.rb, line 13
def deployments
  ProjectDeployments.new(client)
end
environments() click to toggle source
# File lib/labclient/projects/environments/client.rb, line 13
def environments
  ProjectEnvironments.new(client)
end
fork(project_id, query = {}) click to toggle source
# File lib/labclient/projects/forks/fork.rb, line 36
def fork(project_id, query = {})
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/fork", Project, query)
end
fork_existing(project_id, source_id) click to toggle source
# File lib/labclient/projects/forks/existing.rb, line 19
def fork_existing(project_id, source_id)
  project_id = format_id(project_id)
  source_id = format_id(source_id)

  client.request(:post, "projects/#{project_id}/fork/#{source_id}", Project)
end
fork_remove(project_id) click to toggle source
# File lib/labclient/projects/forks/remove.rb, line 19
def fork_remove(project_id)
  project_id = format_id(project_id)

  client.request(:delete, "projects/#{project_id}/fork")
end
forks(project_id, query = {}) click to toggle source
# File lib/labclient/projects/forks/list.rb, line 30
def forks(project_id, query = {})
  project_id = format_id(project_id)

  query_access_level(query, :min_access_level)

  client.request(:get, "projects/#{project_id}/forks", Project, query)
end
github_import(query) click to toggle source
# File lib/labclient/projects/github_import.rb, line 19
def github_import(query)
  client.request(:post, 'import/github', nil, query)
end
hooks() click to toggle source
# File lib/labclient/projects/hooks/client.rb, line 13
def hooks
  ProjectHooks.new(client)
end
housekeeping(project_id) click to toggle source
# File lib/labclient/projects/housekeeping.rb, line 23
def housekeeping(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/housekeeping", nil)
end
labels() click to toggle source
# File lib/labclient/projects/labels/client.rb, line 13
def labels
  ProjectLabels.new(client)
end
languages(project_id) click to toggle source
# File lib/labclient/projects/languages.rb, line 22
def languages(project_id)
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/languages")
end
list(query = {}) click to toggle source

List/Search users

# File lib/labclient/projects/list.rb, line 85
def list(query = {})
  query_access_level(query, :min_access_level)
  client.request(:get, 'projects', Project, query)
end
milestones() click to toggle source
# File lib/labclient/projects/milestones/client.rb, line 13
def milestones
  ProjectMilestones.new(client)
end
mirror_start(project_id) click to toggle source
# File lib/labclient/projects/mirror_start.rb, line 20
def mirror_start(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/mirror/pull", nil)
end
mirrors() click to toggle source
# File lib/labclient/projects/mirrors/client.rb, line 13
def mirrors
  ProjectMirrors.new(client)
end
pipeline_schedules() click to toggle source
# File lib/labclient/projects/pipeline_schedules/client.rb, line 13
def pipeline_schedules
  PipelineSchedules.new(client)
end
push_rules() click to toggle source
# File lib/labclient/projects/push_rules/client.rb, line 13
def push_rules
  PushRules.new(client)
end
releases() click to toggle source
# File lib/labclient/projects/release_links/client.rb, line 13
def releases
  ProjectReleases.new(client)
end
restore(project_id) click to toggle source
# File lib/labclient/projects/restore.rb, line 20
def restore(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/restore", Project)
end
runners() click to toggle source
# File lib/labclient/projects/runners/client.rb, line 13
def runners
  ProjectRunners.new(client)
end
search_within(project_id, scope, search_string = '') click to toggle source

Search All Projects

# File lib/labclient/projects/search.rb, line 52
def search_within(project_id, scope, search_string = '')
  project_id = format_id(project_id)

  scope = scope.to_sym # Case Simplicity
  query = { scope: scope, search: search_string }

  klass = klass_type(scope)

  client.request(:get, "projects/#{project_id}/search", klass, query)
end
services() click to toggle source
# File lib/labclient/projects/services/client.rb, line 25
def services
  ProjectServices.new(client)
end
share(project_id, query = {}) click to toggle source
# File lib/labclient/projects/share.rb, line 44
def share(project_id, query = {})
  project_id = format_id(project_id)

  # Convert Access if needed
  query_access_level(query, :group_access)

  # Convert Time if needed
  query_format_time(query, :expires_at)

  client.request(:post, "projects/#{project_id}/share", nil, query)
end
show(project_id, query = {}) click to toggle source
# File lib/labclient/projects/show.rb, line 41
def show(project_id, query = {})
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}", Project, query)
end
snapshot(project_id, file_name, wiki = false) click to toggle source
# File lib/labclient/projects/snapshot.rb, line 18
def snapshot(project_id, file_name, wiki = false)
  project_id = format_id(project_id)

  raw = client.request(:get, "projects/#{project_id}/snapshot"), { wiki: wiki }
  File.write(file_name, raw)
end
snippets() click to toggle source
# File lib/labclient/projects/snippets/client.rb, line 13
def snippets
  ProjectSnippets.new(client)
end
star(project_id) click to toggle source
# File lib/labclient/projects/stars/star.rb, line 35
def star(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/star", Project)
end
starred(user_id, query = {}) click to toggle source

List/Search users

# File lib/labclient/projects/stars/starred_projects.rb, line 43
def starred(user_id, query = {})
  query_access_level(query, :min_access_level)

  client.request(:get, "users/#{user_id}/starred_projects", Project, query)
end
starrers(project_id, search = '') click to toggle source
# File lib/labclient/projects/stars/starrers.rb, line 29
def starrers(project_id, search = '')
  project_id = format_id(project_id)

  results = if search.empty?
              client.request(:get, "projects/#{project_id}/starrers", nil)
            else
              client.request(:get, "projects/#{project_id}/starrers", nil, search: search)
            end

  results.map do |star_data|
    star_data.user[:starred_since] = Time.parse star_data.starred_since
    User.new star_data.user
  end
end
submodule(project_id, submodule_id, query) click to toggle source
# File lib/labclient/projects/submodule.rb, line 28
def submodule(project_id, submodule_id, query)
  project_id = format_id(project_id)

  client.request(:put, "projects/#{project_id}/repository/submodules/#{submodule_id}", Commit, query)
end
transfer(project_id, namespace_id) click to toggle source
# File lib/labclient/projects/transfer.rb, line 20
def transfer(project_id, namespace_id)
  project_id = format_id(project_id)
  namespace_id = format_id(namespace_id)

  client.request(:put, "projects/#{project_id}/transfer", Project, { namespace: namespace_id })
end
triggers() click to toggle source
# File lib/labclient/projects/triggers/client.rb, line 13
def triggers
  ProjectTriggers.new(client)
end
unarchive(project_id) click to toggle source
# File lib/labclient/projects/unarchive.rb, line 19
def unarchive(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/unarchive", Project)
end
unshare(project_id, group_id) click to toggle source
# File lib/labclient/projects/unshare.rb, line 20
def unshare(project_id, group_id)
  project_id = format_id(project_id)
  group_id = format_id(group_id)

  client.request(:delete, "projects/#{project_id}/share/#{group_id}", nil)
end
unstar(project_id) click to toggle source
# File lib/labclient/projects/stars/star.rb, line 41
def unstar(project_id)
  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/unstar", Project)
end
update(project_id, query = {}) click to toggle source
# File lib/labclient/projects/update.rb, line 31
def update(project_id, query = {})
  project_id = format_id(project_id)

  client.request(:put, "projects/#{project_id}", Project, query)
end
upload(project_id, path) click to toggle source
# File lib/labclient/projects/upload.rb, line 20
def upload(project_id, path)
  project_id = format_id(project_id)

  file = File.open(path, 'r')

  client.request(:post, "projects/#{project_id}/uploads", nil, { file: file }, false)
end
user(user_id, query = {}) click to toggle source

List/Search users

# File lib/labclient/projects/user.rb, line 44
def user(user_id, query = {})
  user_id = format_id(user_id)

  query_access_level(query, :min_access_level)

  client.request(:get, "users/#{user_id}/projects", Project, query)
end
users(project_id, query = {}) click to toggle source
# File lib/labclient/projects/users.rb, line 33
def users(project_id, query = {})
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/users", User, query)
end
variables() click to toggle source
# File lib/labclient/projects/variables/client.rb, line 13
def variables
  ProjectVariables.new(client)
end

Private Instance Methods

klass_type(scope) click to toggle source

TODO: - Finish Classes

# File lib/labclient/projects/search.rb, line 76
def klass_type(scope)
  case scope
  when :issues then Issue
  when :merge_requests then MergeRequest
  when :notes then Note
  when :wiki_blobs, :milestones, :blobs then nil
  when :commits then Commit
  when :users then User
  end
end