Skip to content

Commit edcfaad

Browse files
committed
Moving IncrementableAttributes to it's own module.
1 parent 90af6a7 commit edcfaad

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

intercom/traits/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class IncrementableAttributes(object):
2+
3+
def increment(self, key, value=1):
4+
existing_value = self.custom_attributes.get(key, 0)
5+
self.custom_attributes[key] = existing_value + value

intercom/user.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from intercom.api_operations.save import Save
1616
from intercom.lib.flat_store import FlatStore
1717
from intercom.lib.typed_json_deserializer import JsonDeserializer
18+
from intercom.traits.incrementable_attributes import IncrementableAttributes
1819

1920

2021
def timestamp_field(attribute):
@@ -115,20 +116,9 @@ class DynamicClass(Resource):
115116
return dyncls
116117

117118

118-
119-
class IncrementableAttributes(object):
120-
121-
def increment(self, key, value=1):
122-
existing_value = self.custom_attributes.get(key, 0)
123-
self.custom_attributes[key] = existing_value + value
124-
125-
126119
class User(Resource, Find, FindAll, All, Count, Save, Delete, IncrementableAttributes):
127120

128121
@property
129122
def flat_store_attributes(self):
130123
return ['custom_attributes']
131124

132-
133-
# class Count(Resource):
134-
# pass

0 commit comments

Comments
 (0)