lib/intercom/user.rb in intercom-0.1.7 vs lib/intercom/user.rb in intercom-0.1.8
- old
+ new
@@ -19,10 +19,12 @@
# * Updating custom data on a user
# user = Intercom::User.find_by_email("bob@example.com")
# user.custom_data["number_of_applications"] = 11
# user.save
class User < UserResource
+
+
##
# Fetches an Intercom::User from our API.
#
# Calls GET https://api.intercom.io/v1/users
#
@@ -76,9 +78,25 @@
# > ["user1@example.com" ,"user2@example.com" ,....]
#
# @return [UserCollectionProxy]
def self.all
UserCollectionProxy.new
+ end
+
+ # Retrieve all the users that match a query
+ # Examples:
+ # Intercom::User.where(:tag_name => 'Free Trial').each do |user|
+ # puts user.inspect
+ # end
+ # > ["user1@example.com" ,"user2@example.com" ,....]
+ # Intercom::User.where(:tag_name => 'Free Trial').map(&:email)
+ # > ["user1@example.com" ,"user2@example.com" ,....]
+ #
+ # Currently only supports tag_name and tag_id querying
+ #
+ # @return [UserCollectionProxy]
+ def self.where(params)
+ UserCollectionProxy.new(params)
end
# Fetches a count of all Users tracked on Intercom.
# Example:
# Intercom::User.all.count