class Thumbtack::Tags

Wraps API calls related to tags

Public Class Methods

new(client) click to toggle source

Initialize a Tags

@param [Client] client

client to communicate with the Pinboard API

@api private

# File lib/thumbtack/tags.rb, line 12
def initialize(client)
  @client = client
end

Public Instance Methods

delete(tag) click to toggle source

Delete a tag

@example

tags.delete(tag)

@param [String] tag

the tag to delete

@return [self]

@api public

@see pinboard.in/api/#tags_delete

# File lib/thumbtack/tags.rb, line 45
def delete(tag)
  parameters = Specification.new(tag: Types::Tags).parameters(tag: tag)
  @client.action('/tags/delete', parameters)
  self
end
get() click to toggle source

List tags with their counts

@example

tag_counts = tags.get

@return [Hash{String => Integer}]

tags associated with the number of times they have been used

@api public

@see pinboard.in/api/#tags_get

# File lib/thumbtack/tags.rb, line 27
def get
  response = @client.get('/tags/get')
  Hash[response.map { |tag, count| [tag, count.to_i] }]
end
rename(old, new) click to toggle source

Rename a tag

@example

tags.rename(old, new)

@param [String] old

the tag to be renamed

@param [String] new

the new name for the tag

@return [self]

@api public

@see pinboard.in/api/#tags_rename

# File lib/thumbtack/tags.rb, line 66
def rename(old, new)
  parameters = Specification.new(
    old: Types::Tags,
    new: Types::Tags
  ).parameters(old: old, new: new)
  @client.action('/tags/rename', parameters)
  self
end