Class: LabClient::ProtectedTags

Inherits:
Common
  • Object
show all
Defined in:
lib/labclient/protected_tags/list.rb,
lib/labclient/protected_tags/show.rb,
lib/labclient/protected_tags/protect.rb,
lib/labclient/protected_tags/unprotect.rb

Overview

Specifics

Constant Summary

Constants included from AccessLevel

AccessLevel::HUMAN_ACCESS_LEVELS, AccessLevel::MACHINE_ACCESS_LEVELS

Instance Attribute Summary

Attributes inherited from Common

#client

Instance Method Summary collapse

Methods inherited from Common

#api_methods, #api_methods_help, #format_id, #format_query_id, #format_query_ids, #format_time?, #group_name, #help, #initialize, #inspect, #klass, #protected_query_access_level, #query_access_level, #query_format_time

Methods included from Docs

#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title

Methods included from AccessLevel

#human_access_level, #human_protected_access_level, #machine_access_level, #machine_protected_access_level

Constructor Details

This class inherits a constructor from LabClient::Common

Instance Method Details

#list(project_id) ⇒ Object



23
24
25
26
27
# File 'lib/labclient/protected_tags/list.rb', line 23

def list(project_id)
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/protected_tags", Tag)
end

#protect(project_id, query) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/labclient/protected_tags/protect.rb', line 33

def protect(project_id, query)
  protected_query_access_level(query, :push_access_level)
  protected_query_access_level(query, :merge_access_level)
  protected_query_access_level(query, :create_access_level)
  # POST /projects/:id/protected_tags

  project_id = format_id(project_id)

  client.request(:post, "projects/#{project_id}/protected_tags", Tag, query)
end

#show(project_id, tag_id) ⇒ Object



19
20
21
22
# File 'lib/labclient/protected_tags/show.rb', line 19

def show(project_id, tag_id)
  project_id = format_id(project_id)
  client.request(:get, "projects/#{project_id}/protected_tags/#{tag_id}", Tag)
end

#unprotect(project_id, tag_id) ⇒ Object



19
20
21
22
# File 'lib/labclient/protected_tags/unprotect.rb', line 19

def unprotect(project_id, tag_id)
  project_id = format_id(project_id)
  client.request(:delete, "projects/#{project_id}/protected_tags/#{tag_id}", Tag)
end