@@ -46,9 +46,8 @@ class User(UserId):
46
46
""" Object representing http://docs.intercom.io/#UserData). """
47
47
48
48
attributes = (
49
- 'user_id' , 'email' , 'name' , 'created_at' , 'custom_data' ,
50
- 'last_seen_ip' , 'last_seen_user_agent' , 'companies' ,
51
- 'last_impression_at' , 'last_request_at' , 'unsubscribed_from_emails' )
49
+ 'user_id' , 'email' , 'name' , 'signed_up_at' , 'custom_attributes' ,
50
+ 'last_seen_ip' , 'user_agent_data' , 'companies' , 'last_request_at' , 'update_last_request_at' , 'last_seen_user_agent' , 'unsubscribed_from_emails' )
52
51
53
52
@classmethod
54
53
def find (cls , user_id = None , email = None ):
@@ -195,6 +194,16 @@ def last_seen_user_agent(self, last_seen_user_agent):
195
194
""" Sets the last seen User Agent. """
196
195
self ['last_seen_user_agent' ] = last_seen_user_agent
197
196
197
+ @property
198
+ def update_last_request_at (self ):
199
+ """ Returns the last seen User Agent. """
200
+ return dict .get (self , 'update_last_request_at' , None )
201
+
202
+ @update_last_request_at .setter
203
+ def update_last_request_at (self , update_last_request_at ):
204
+ """ Sets the last seen User Agent. """
205
+ self ['update_last_request_at' ] = update_last_request_at
206
+
198
207
@property
199
208
@from_timestamp_property
200
209
def last_request_at (self ):
@@ -353,8 +362,8 @@ def companies(self, companies):
353
362
raise ValueError ("companies must be set as a list" )
354
363
355
364
@property
356
- def custom_data (self ):
357
- """ Returns a CustomData object for this User.
365
+ def custom_attributes (self ):
366
+ """ Returns a CustomAttributes object for this User.
358
367
359
368
>>> users = User.all()
360
369
>>> custom_data = users[0].custom_data
@@ -364,15 +373,15 @@ def custom_data(self):
364
373
155.5
365
374
366
375
"""
367
- data = dict .get (self , 'custom_data ' , None )
368
- if not isinstance (data , CustomData ):
369
- data = CustomData (data )
370
- dict .__setitem__ (self , 'custom_data ' , data )
376
+ data = dict .get (self , 'custom_attributes ' , None )
377
+ if not isinstance (data , CustomAttributes ):
378
+ data = CustomAttributes (data )
379
+ dict .__setitem__ (self , 'custom_attributes ' , data )
371
380
return data
372
381
373
- @custom_data .setter
374
- def custom_data (self , custom_data ):
375
- """ Sets the CustomData for this User.
382
+ @custom_attributes .setter
383
+ def custom_attributes (self , custom_attributes ):
384
+ """ Sets the CustomAttributes for this User.
376
385
377
386
>>> user = User(email="somebody@example.com")
378
387
>>> user.custom_data = { 'max_monthly_spend': 200 }
@@ -383,17 +392,17 @@ def custom_data(self, custom_data):
383
392
3
384
393
385
394
"""
386
- if not isinstance (custom_data , CustomData ):
387
- custom_data = CustomData ( custom_data )
388
- self ['custom_data ' ] = custom_data
395
+ if not isinstance (custom_attributes , CustomAttributes ):
396
+ custom_attributes = CustomAttributes ( custom_attributes )
397
+ self ['custom_attributes ' ] = custom_attributes
389
398
390
399
391
- class CustomData (dict ):
400
+ class CustomAttributes (dict ):
392
401
""" A dict that limits keys to strings, and values to real numbers
393
402
and strings.
394
403
395
- >>> from intercom.user import CustomData
396
- >>> data = CustomData ()
404
+ >>> from intercom.user import CustomAttributes
405
+ >>> data = CustomAttributes ()
397
406
>>> data['a_dict'] = {}
398
407
Traceback (most recent call last):
399
408
...
@@ -412,10 +421,10 @@ def __setitem__(self, key, value):
412
421
isinstance (value , basestring )
413
422
):
414
423
raise ValueError (
415
- "custom data only allows string and real number values" )
424
+ "custom attributes only allows string and real number values" )
416
425
if not isinstance (key , basestring ):
417
- raise ValueError ("custom data only allows string keys" )
418
- super (CustomData , self ).__setitem__ (key , value )
426
+ raise ValueError ("custom attributes only allows string keys" )
427
+ super (CustomAttributes , self ).__setitem__ (key , value )
419
428
420
429
421
430
class SocialProfile (dict ):
0 commit comments