Method: Snitcher::API::Client#add_tags

Defined in:
lib/snitcher/api/client.rb

#add_tags(token, tags = []) ⇒ Array<String>

Add one or more tags to an existing snitch, identified by token.

Examples:

Add tags to an existing snitch.

client.add_tags("c2354d53d2", ["red", "green"])
# => [ "yellow", "red", "green" ]

Adding a single tag

client.add_tags("c2354d53d2", "orange")
# => [ "yellow", "orange" ]

Parameters:

  • token (String)

    The unique token of the Snitch.

  • tags (Array<String>) (defaults to: [])

    Tag or tags to add to the list of tags already on the Snitch.

Returns:

  • (Array<String>)

    full list of tags on the Snitch.

Raises:



218
219
220
221
222
# File 'lib/snitcher/api/client.rb', line 218

def add_tags(token, tags = [])
  token = CGI.escape(token)

  post("/v1/snitches/#{token}/tags", Array(tags).flatten)
end