securenative 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/models/sdk_event.rb +9 -0
- data/securenative.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b61f74882bbf23be71999125df784a88a509c29ef3ca5cee0569ebdaa2063f32
|
|
4
|
+
data.tar.gz: c6305ecadb3bf5d45245b54dfa336fc7d8b2774b0ceb7fc8997c2cdb1060a4a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a46b6fed3c5478412f1e437142e2c74bc8e27d8213c0c8af8d08c4ad2dbfc71c13cf8695cd31a406d1600eb5005ce206ee7b3613b4dbb436cb072a199e3a7a2
|
|
7
|
+
data.tar.gz: c14bdfe15041f74dc7b899f8b8eac5b8d3228a5f638a1d0edd347a4793bbdf7ce9bc9c39e78d7a38b595feb0044337e2e2e73679dd804364ccc79057fb7f8c89
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -96,7 +96,7 @@ require 'models/user_traits'
|
|
|
96
96
|
|
|
97
97
|
def track
|
|
98
98
|
securenative = SecureNative.instance
|
|
99
|
-
context = SecureNativeContext.new(client_token: '
|
|
99
|
+
context = SecureNativeContext.new(client_token: 'SECURED_CLIENT_TOKEN', ip: '127.0.0.1',
|
|
100
100
|
headers: { 'user-agent' => 'Mozilla: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.3 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/43.4' })
|
|
101
101
|
|
|
102
102
|
event_options = EventOptions.new(event: EventTypes::LOG_IN, user_id: '1234', context: context,
|
|
@@ -118,7 +118,7 @@ require 'enums/event_types'
|
|
|
118
118
|
require 'models/user_traits'
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
def track
|
|
121
|
+
def track(request)
|
|
122
122
|
securenative = SecureNative.instance
|
|
123
123
|
context = SecureNativeContext.from_http_request(request)
|
|
124
124
|
|
data/lib/models/sdk_event.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'context/securenative_context'
|
|
4
|
+
require 'errors/securenative_invalid_options_error'
|
|
4
5
|
require 'utils/encryption_utils'
|
|
5
6
|
require 'utils/date_utils'
|
|
6
7
|
require 'models/request_context'
|
|
@@ -11,6 +12,14 @@ class SDKEvent
|
|
|
11
12
|
attr_writer :context, :rid, :event_type, :user_id, :user_traits, :request, :timestamp, :properties
|
|
12
13
|
|
|
13
14
|
def initialize(event_options, securenative_options)
|
|
15
|
+
if event_options.user_id.nil? || event_options.user_id.length <= 0 || event_options.user_id == ''
|
|
16
|
+
raise SecureNativeInvalidOptionsError.new, 'Invalid event structure; User Id is missing'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
if event_options.event.nil? || event_options.event.length <= 0 || event_options.event == ''
|
|
20
|
+
raise SecureNativeInvalidOptionsError.new, 'Invalid event structure; Event Type is missing'
|
|
21
|
+
end
|
|
22
|
+
|
|
14
23
|
@context = if !event_options.context.nil?
|
|
15
24
|
event_options.context
|
|
16
25
|
else
|
data/securenative.gemspec
CHANGED