lib/intercom/user.rb in intercom-0.1.12 vs lib/intercom/user.rb in intercom-0.1.13
- old
+ new
@@ -127,10 +127,17 @@
def save
response = Intercom.post("/v1/users", to_hash)
self.update_from_api_response(response)
end
+ # Increment a custom data value on a user
+ # @return [User]
+ def increment(key, value=1)
+ increments[key] ||= 0
+ increments[key] += value
+ end
+
# @return [String] the {User}'s name
def name
@attributes["name"]
end
@@ -327,8 +334,16 @@
@social_profiles = social_profiles.map { |account| SocialProfile.new(account) }.freeze
end
def location_data=(hash) #:nodoc:
@location_data = hash.freeze
+ end
+
+ def increments
+ @attributes["increments"] ||= {}
+ end
+
+ def increments=(hash)
+ @attributes["increments"] = hash
end
end
end