@@ -155,34 +155,53 @@ def get_user(cls, email=None, user_id=None):
155155 return user_dict
156156
157157 @classmethod
158- def create_user (
159- cls , user_id = None , email = None , name = None , created_at = None ,
160- custom_data = None , last_seen_ip = None , last_seen_user_agent = None ):
161- """ Create a user from the available parameters.
158+ def create_user (cls , ** kwargs ):
159+ """ Creates a user.
160+
161+ N.B. Social and geo location data is fetched asynchronously, so a
162+ secondary call to users will be required to fetch it.
163+
164+ **Arguments**
165+
166+ - ``user_id``: required (if no email) — a unique string identifier
167+ for the user
168+ - ``email``: required (if no user_id) — the user's email address
169+ - ``name``: The user's full name
170+ - ``created_at``: A UNIX timestamp representing the date the user was
171+ created
172+ - ``custom_data``: A hash of key/value pairs containing any other data
173+ about the user you want Intercom to store.
174+ - ``last_seen_ip``: An ip address (e.g. "1.2.3.4") representing the
175+ last ip address the user visited your application from. (Used for
176+ updating location_data)
177+ - ``last_seen_user_agent``: The user agent the user last visited your
178+ application with.
179+ - ``companies``: An array of hashes describing the companies this user
180+ belongs to. Currently companies are not returned in the response.
181+ - ``last_request_at or last_impression_at``: A UNIX timestamp
182+ representing the date the user last visited your application.
183+ - ``unsubscribed_from_emails``: A boolean value representing the users
184+ unsubscribed status.
185+
162186
163187 >>> from datetime import datetime
164188 >>> import time
165189 >>> now = time.mktime(datetime.now().timetuple())
166190 >>> user = Intercom.create_user(user_id='987', email='joe@example.com',
167191 ... name='Joe Example', created_at=now, last_seen_ip='10.10.10.10',
168- ... custom_data={ 'job_type': 'smuggler'})
192+ ... custom_data={ 'job_type': 'smuggler'}, last_request_at=1350000000 )
169193 >>> user['name']
170194 u'Joe Example'
171195 >>> user['custom_data']['job_type']
172196 u'smuggler'
197+ >>> user['last_impression_at']
198+ 1350000000
173199
174200 """
175- return Intercom ._create_or_update_user (
176- 'POST' , user_id = user_id , email = email , name = name ,
177- created_at = created_at , custom_data = custom_data ,
178- last_seen_ip = last_seen_ip ,
179- last_seen_user_agent = last_seen_user_agent )
201+ return Intercom ._create_or_update_user ('POST' , ** kwargs )
180202
181203 @classmethod
182- def update_user (
183- cls , user_id = None , email = None , name = None , created_at = None ,
184- custom_data = None , last_seen_ip = None , last_seen_user_agent = None ,
185- unsubscribed_from_emails = None ):
204+ def update_user (cls , ** kwargs ):
186205 """ Update a user with the available parameters.
187206
188207 >>> user = Intercom.get_user(user_id='123')
@@ -193,12 +212,7 @@ def update_user(
193212 u'Han'
194213
195214 """
196- return Intercom ._create_or_update_user (
197- 'PUT' , user_id = user_id , email = email , name = name ,
198- created_at = created_at , custom_data = custom_data ,
199- last_seen_ip = last_seen_ip ,
200- last_seen_user_agent = last_seen_user_agent ,
201- unsubscribed_from_emails = unsubscribed_from_emails )
215+ return Intercom ._create_or_update_user ('PUT' , ** kwargs )
202216
203217 @classmethod
204218 def delete_user (cls , user_id = None , email = None ):
0 commit comments