Module: Highrise::Taggable

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

Instance Method Summary collapse

Instance Method Details

#tag!(tag_name) ⇒ Object


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

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.attributes.has_key?("tags") ? self.attributes["tags"] : self.get(:tags)
end

#untag!(tag_name) ⇒ Object


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

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