Class: Tenk::Projects::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/projects/tags.rb

Overview

API methods for attaching and removing tags from a project

Defined Under Namespace

Classes: ListRequest

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Tags

Initialize a Tenk::Projects::Tag resource API wrapper for the given client



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

def initialize(client)
  @_client = client
end

Instance Method Details

#add(project_id, tag) ⇒ Hashie::Mash

Attach a tag to a project

Parameters:

  • project_id (Integer)

    the id of the project

  • tag (String)

    the string of the tag to attach

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash



32
33
34
# File 'lib/projects/tags.rb', line 32

def add(project_id, tag)
  @_client.post("/projects/#{project_id}/tags", value: tag)
end

#list(project_id) ⇒ Hashie::Mash

List Tags for a single project

Parameters:

  • project_id (Integer)

    the id of the project

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



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

def list(project_id)
  @_client.get("/projects/#{project_id}/tags")
end

#remove(project_id, tag_id) ⇒ Hashie::Mash

Remove a tag from a project

Parameters:

  • project_id (Integer)

    the id of the project

  • tag_id (Integer)

    the integer id of the tag

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash



40
41
42
# File 'lib/projects/tags.rb', line 40

def remove(project_id, tag_id)
  @_client.delete("/projects/#{project_id}/tags/#{tag_id}")
end