Module: Highrise::Taggable

Included in:
Company, Person
Defined in:
lib/highrise/taggable.rb

Instance Method Summary collapse

Instance Method Details

#tag!(tag_name) ⇒ Object



6
7
8
# File 'lib/highrise/taggable.rb', line 6

def tag!(tag_name)
  self.post(:tags, :name => tag_name) unless tag_name.blank?
end

#tagsObject



3
4
5
# File 'lib/highrise/taggable.rb', line 3

def tags
  self.get(:tags)
end

#untag!(tag_name) ⇒ Object



9
10
11
12
# File 'lib/highrise/taggable.rb', line 9

def untag!(tag_name)
  to_delete = self.tags.find{|tag| tag['name'] == tag_name} unless tag_name.blank?
  self.untag_id!(to_delete['id']) unless to_delete.nil?
end

#untag_id!(tag_id) ⇒ Object



13
14
15
# File 'lib/highrise/taggable.rb', line 13

def untag_id!(tag_id)
  self.delete("tags/#{tag_id}")
end