Class: LabClient::Wikis

Inherits:
Common
  • Object
show all
Defined in:
lib/labclient/wikis/list.rb,
lib/labclient/wikis/show.rb,
lib/labclient/wikis/create.rb,
lib/labclient/wikis/delete.rb,
lib/labclient/wikis/update.rb,
lib/labclient/wikis/upload.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

#create(project_id, query) ⇒ Object



27
28
29
30
31
# File 'lib/labclient/wikis/create.rb', line 27

def create(project_id, query)
  project_id = format_id(project_id)

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

#delete(project_id, slug) ⇒ Object



26
27
28
29
30
# File 'lib/labclient/wikis/delete.rb', line 26

def delete(project_id, slug)
  project_id = format_id(project_id)

  client.request(:delete, "projects/#{project_id}/wikis/#{slug}")
end

#list(project_id, with_content = false) ⇒ Object



21
22
23
24
# File 'lib/labclient/wikis/list.rb', line 21

def list(project_id, with_content = false)
  project_id = format_id(project_id)
  client.request(:get, "projects/#{project_id}/wikis", Wiki, { with_content: with_content })
end

#show(project_id, slug) ⇒ Object



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

def show(project_id, slug)
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/wikis/#{slug}", Wiki)
end

#update(project_id, slug, query) ⇒ Object



36
37
38
39
40
# File 'lib/labclient/wikis/update.rb', line 36

def update(project_id, slug, query)
  project_id = format_id(project_id)

  client.request(:put, "projects/#{project_id}/wikis/#{slug}", Wiki, query)
end

#upload(project_id, path, branch = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/labclient/wikis/upload.rb', line 19

def upload(project_id, path, branch = nil)
  project_id = format_id(project_id)

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

  client.request(:post, "projects/#{project_id}/wikis/attachments", nil, { file: file, branch: branch }, false)
end