Skip to content

Commit

Permalink
Add parameter to specify op and update example
Browse files Browse the repository at this point in the history
  • Loading branch information
erskingardner committed Apr 2, 2013
1 parent 1a2fcb5 commit efc6e19
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/intercom/tag.rb
Expand Up @@ -17,6 +17,14 @@ module Intercom
# tag.name = "Super Tag" # tag.name = "Super Tag"
# tag.color = "red" # tag.color = "red"
# tag.user_ids = ['abc123', 'def456'] # tag.user_ids = ['abc123', 'def456']
# tag.tag_or_untag = "tag"
# tag.save
#
# Or update a tag and save it like this:
# tag = Intercom::Tag.find_by_name "Super Tag"
# tag.color = "green"
# tag.user_ids = ['abc123', 'def456']
# tag.tag_or_untag = "untag"
# tag.save # tag.save


class Tag < UserResource class Tag < UserResource
Expand Down Expand Up @@ -47,7 +55,7 @@ def self.create(params)
end end


## ##
# Saves a note on your application # Saves a Tag on your application
def save def save
response = Intercom.post("/v1/tags", to_hash) response = Intercom.post("/v1/tags", to_hash)
self.update_from_api_response(response) self.update_from_api_response(response)
Expand Down Expand Up @@ -77,5 +85,12 @@ def emails=(emails)
@attributes["emails"] = emails @attributes["emails"] = emails
end end


##
# A string to specify whether to tag or untag the specified users, can be left out if only creating a new tag.
def tag_or_untag=(tag_or_untag)
return unless ["tag", "untag"].include?(tag_or_untag)
@attributes["tag_or_untag"] = tag_or_untag
end

end end
end end

0 comments on commit efc6e19

Please sign in to comment.