Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Adding support to tag and untag groups of users #21

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Member

erskingardner commented Mar 22, 2013

No description provided.

Contributor

benmcredmond commented Mar 22, 2013

I don't love this.

It feels totally weird to be handling tagging operations on a class which is typically used to represent a single user.

Maybe we could have a Tag class instead? A tag would have a users attribute which you could use to tag people. e.g.

  t = Intercom::Tag.new(:name => "my tag")
  t.users << "ben@intercom.io"
  t.save

Thoughts?

Contributor

benmcredmond commented Mar 22, 2013

eek didn't mean to close

@benmcredmond benmcredmond reopened this Mar 22, 2013

@benmcredmond benmcredmond commented on the diff Mar 22, 2013

lib/intercom/user.rb
+ # Intercom::User.tag(:user_ids => ["joe@example.com", "bob@example.com"], :tag => "Test Tag")
+ #
+ # returns a hash of the tag name and the users tagged.
+ #
+ # @return [Hash]
+ def self.tag(params)
+ Intercom.post("/v1/users/tag", params)
+ end
+
+ # Untags a group of users with a tag on your application.
+ #
+ # Calls POST https://api.intercom.io/v1/users/untag
+ #
+ # Examples:
+ # Intercom::User.untag(:user_ids => ["abc123", "def456"], :tag => "Test Tag")
+ # Intercom::User.untag(:user_ids => ["joe@example.com", "bob@example.com"], :tag => "Test Tag")
@benmcredmond

benmcredmond Mar 22, 2013

Contributor

The actual API seems to reference user_emails for emails (which I also think we should change because we don't call it that anywhere else, should be emails)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment