Skip to content

Commit 91ce9d8

Browse files
authored
Merge pull request #33 from securenative/dev
Dev
2 parents 8b18f92 + a7f5adc commit 91ce9d8

File tree

7 files changed

+12
-10
lines changed

7 files changed

+12
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ context = SecureNative.context_builder().\
100100

101101
event_options = EventOptionsBuilder(EventTypes.LOG_IN).\
102102
with_user_id("1234").\
103-
with_user_traits(UserTraits("Your Name", "[email protected]")).\
103+
with_user_traits(UserTraits("Your Name", "[email protected]", "+1234567890")).\
104104
with_context(context).\
105105
with_properties({"prop1": "CUSTOM_PARAM_VALUE", "prop2": True, "prop3": 3}).\
106106
build()
@@ -123,7 +123,7 @@ def track(request):
123123

124124
event_options = EventOptionsBuilder(EventTypes.LOG_IN).\
125125
with_user_id("1234").\
126-
with_user_traits(UserTraits("Your Name", "[email protected]")).\
126+
with_user_traits(UserTraits("Your Name", "[email protected]", "+1234567890")).\
127127
with_context(context).\
128128
with_properties({"prop1": "CUSTOM_PARAM_VALUE", "prop2": True, "prop3": 3}).\
129129
build()
@@ -148,7 +148,7 @@ def track(request):
148148

149149
event_options = EventOptionsBuilder(EventTypes.LOG_IN).\
150150
with_user_id("1234").\
151-
with_user_traits(UserTraits("Your Name", "[email protected]")).\
151+
with_user_traits(UserTraits("Your Name", "[email protected]", "+1234567890")).\
152152
with_context(context).\
153153
with_properties({"prop1": "CUSTOM_PARAM_VALUE", "prop2": True, "prop3": 3}).\
154154
build()

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.1
1+
0.2.2

securenative/event_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import time
44

55
from securenative.config.securenative_options import SecureNativeOptions
6-
from securenative.exceptions.securenative_http_exception import SecureNativeHttpException
76
from securenative.http.securenative_http_client import SecureNativeHttpClient
87
from securenative.logger import Logger
98

@@ -91,6 +90,7 @@ def run(self):
9190
item.retry = False
9291
elif res.status_code != 200:
9392
item.retry = True
93+
self.queue.remove(item)
9494

9595
Logger.debug("Event successfully sent; {}".format(item.body))
9696
except Exception as e:
@@ -134,6 +134,7 @@ def serialize(obj):
134134
"userTraits": {
135135
"name": obj.user_traits.name,
136136
"email": obj.user_traits.email,
137+
"phone": obj.user_traits.phone,
137138
"createdAt": obj.user_traits.created_at,
138139
},
139140
"request": {

securenative/event_options_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def with_user_traits(self, user_traits):
1717
self.event_options.user_traits = user_traits
1818
return self
1919

20-
def with_user(self, name, email, created_at=None):
21-
self.event_options.user_traits = UserTraits(name, email, created_at)
20+
def with_user(self, name, email, phone=None, created_at=None):
21+
self.event_options.user_traits = UserTraits(name, email, phone, created_at)
2222
return self
2323

2424
def with_context(self, context):

securenative/models/user_traits.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class UserTraits(object):
22

3-
def __init__(self, name=None, email=None, created_at=None):
3+
def __init__(self, name=None, email=None, phone=None, created_at=None):
44
self.name = name
55
self.email = email
66
self.created_at = created_at
7+
self.phone = phone

tests/api_manager_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def setUp(self):
2727

2828
self.event_options = EventOptionsBuilder(EventTypes.LOG_IN). \
2929
with_user_id("USER_ID"). \
30-
with_user_traits(UserTraits("USER_NAME", "USER_EMAIL")). \
30+
with_user_traits(UserTraits("USER_NAME", "USER_EMAIL", "+12012673412")). \
3131
with_context(self.context). \
3232
with_properties({"prop1": "CUSTOM_PARAM_VALUE",
3333
"prop2": True,

tests/event_manager_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self):
1717
self.timestamp = datetime.now().strftime("%Y-%d-%dT%H:%M:%S.%fZ")
1818
self.rid = "432532"
1919
self.user_id = "1"
20-
self.user_traits = UserTraits("some user", "[email protected]")
20+
self.user_traits = UserTraits("some user", "[email protected]", "+12012673412")
2121
self.request = RequestContext()
2222
self.properties = []
2323

0 commit comments

Comments
 (0)