Class: LabClient::ProjectSnippets

Inherits:
Common
  • Object
show all
Includes:
ClassHelpers
Defined in:
lib/labclient/projects/snippets/list.rb,
lib/labclient/projects/snippets/show.rb,
lib/labclient/projects/snippets/client.rb,
lib/labclient/projects/snippets/create.rb,
lib/labclient/projects/snippets/delete.rb,
lib/labclient/projects/snippets/update.rb,
lib/labclient/projects/snippets/content.rb,
lib/labclient/projects/snippets/agent_detail.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 included from ClassHelpers

#has?, #keys

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

#agent_detail(project_id, snippet_id) ⇒ Object

Show Specific



23
24
25
26
27
28
# File 'lib/labclient/projects/snippets/agent_detail.rb', line 23

def agent_detail(project_id, snippet_id)
  snippet_id = format_id(snippet_id)
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/snippets/#{snippet_id}/user_agent_detail")
end

#create(project_id, query = {}) ⇒ Object



35
36
37
38
# File 'lib/labclient/projects/snippets/create.rb', line 35

def create(project_id, query = {})
  project_id = format_id(project_id)
  client.request(:post, "projects/#{project_id}/snippets", ProjectSnippet, query)
end

#delete(project_id, snippet_id) ⇒ Object



20
21
22
23
24
# File 'lib/labclient/projects/snippets/delete.rb', line 20

def delete(project_id, snippet_id)
  snippet_id = format_id(snippet_id)
  project_id = format_id(project_id)
  client.request(:delete, "projects/#{project_id}/snippets/#{snippet_id}")
end

#list(project_id) ⇒ Object

List



14
15
16
17
18
# File 'lib/labclient/projects/snippets/list.rb', line 14

def list(project_id)
  project_id = format_id(project_id)

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

#raw(project_id, snippet_id) ⇒ Object Also known as: content

Show Specific



23
24
25
26
27
28
# File 'lib/labclient/projects/snippets/content.rb', line 23

def raw(project_id, snippet_id)
  snippet_id = format_id(snippet_id)
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/snippets/#{snippet_id}/raw")
end

#show(project_id, snippet_id) ⇒ Object

Show Specific



14
15
16
17
18
# File 'lib/labclient/projects/snippets/show.rb', line 14

def show(project_id, snippet_id)
  snippet_id = format_id(snippet_id)
  project_id = format_id(project_id)
  client.request(:get, "projects/#{project_id}/snippets/#{snippet_id}", ProjectSnippet)
end

#update(project_id, snippet_id, query = {}) ⇒ Object



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

def update(project_id, snippet_id, query = {})
  snippet_id = format_id(snippet_id)
  project_id = format_id(project_id)
  client.request(:put, "projects/#{project_id}/snippets/#{snippet_id}", ProjectSnippet, query)
end