11import uuid
22
3- from securenative .context .context_builder import ContextBuilder
3+ from securenative .context .securenative_context import SecureNativeContext
44from securenative .exceptions .securenative_invalid_options_exception import SecureNativeInvalidOptionsException
5- from securenative .models .request_context import RequestContextBuilder
5+ from securenative .models .request_context import RequestContext
66from securenative .models .user_traits import UserTraits
77from securenative .utils .date_utils import DateUtils
88from securenative .utils .encryption_utils import EncryptionUtils
1111class SDKEvent (object ):
1212
1313 def __init__ (self , event_options , securenative_options ):
14- if event_options .user_id is None or len (event_options .user_id ) <= 0 or event_options .user_id == "" :
14+ if event_options .user_id is None or len (event_options .user_id ) <= 0 or event_options .user_id == "" :
1515 raise SecureNativeInvalidOptionsException ("Invalid event structure; User Id is missing" )
1616
1717 if event_options .context is not None :
1818 self .context = event_options .context
1919 else :
20- self .context = ContextBuilder . default_context_builder (). build ()
20+ self .context = SecureNativeContext ()
2121
2222 if self .context .client_token :
2323 client_token = EncryptionUtils .decrypt (self .context .client_token , securenative_options .api_key )
@@ -38,16 +38,14 @@ def __init__(self, event_options, securenative_options):
3838 self .event_type = event_options .event if event_options .event else ""
3939 self .user_id = event_options .user_id
4040 self .user_traits = user_traits
41- self .request = RequestContextBuilder () \
42- .with_cid (client_token .cid if client_token else "" ) \
43- .with_vid (client_token .vid if client_token else "" ) \
44- .with_fp (client_token .fp if client_token else "" ) \
45- .with_ip (self .context .ip if self .context .ip else "" ) \
46- .with_remote_ip (self .context .remote_ip if self .context .remote_ip else "" ) \
47- .with_method (self .context .method if self .context .method else "" ) \
48- .with_url (self .context .url if self .context .url else "" ) \
49- .with_headers (self .context .headers if self .context .headers else None ) \
50- .build ()
41+ self .request = RequestContext (cid = client_token .cid if client_token else "" ,
42+ vid = client_token .vid if client_token else "" ,
43+ fp = client_token .fp if client_token else "" ,
44+ ip = self .context .ip if self .context .ip else "" ,
45+ remote_ip = self .context .remote_ip if self .context .remote_ip else "" ,
46+ headers = self .context .headers if self .context .headers else None ,
47+ url = self .context .url if self .context .url else "" ,
48+ method = self .context .method if self .context .method else "" )
5149
5250 self .timestamp = DateUtils .to_timestamp (event_options .timestamp )
5351 self .properties = event_options .properties
0 commit comments