datadome_fraud_sdk_ruby 2.2.0 → 2.3.0
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/lib/constants.rb +1 -1
- data/lib/datadome_fraud_sdk_ruby.rb +3 -2
- data/lib/model/api/request.rb +6 -2
- data/lib/model/authentication.rb +51 -0
- data/lib/model/events.rb +92 -11
- data/lib/model/user.rb +15 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af46bd76291b91fa6eed5fd45415a7661783391ff657e6d202a9da6a006ee662
|
4
|
+
data.tar.gz: d3437a3c2e3f4a51bc44a3e4337454910281edccc5e4c05b9382feddbe3416d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ffdf60d53ae616ade9ce9dace737b6df6e1a4a54ec198514dbd1a305ad4575232fbae7e9e58a847888b277b5da81bcce7a1d9495536558bac1a6d9fde0e8044
|
7
|
+
data.tar.gz: c33e5e9069a1d693a87b5fb8278e852d49ae87cb7ee013c77faf6634f0451e950fb9c4b627389b9d176fff8a77d494358d9a68e0bb5e9581ba9a4801da407f3d
|
data/lib/constants.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
SDK_VERSION = '2.
|
1
|
+
SDK_VERSION = '2.3.0'
|
2
2
|
SDK_NAME = 'datadome_fraud_sdk_ruby'
|
@@ -6,6 +6,7 @@ require_relative "model/events"
|
|
6
6
|
require_relative "model/location"
|
7
7
|
require_relative "model/user"
|
8
8
|
require_relative "model/session"
|
9
|
+
require_relative "model/authentication"
|
9
10
|
require_relative "model/operation"
|
10
11
|
require_relative "model/api/request"
|
11
12
|
require_relative "model/api/response"
|
@@ -20,7 +21,7 @@ class DataDome
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def validate(request:, event:)
|
23
|
-
if event.status == DataDomeStatusType::UNDEFINED
|
24
|
+
if event.respond_to?(:status) && event.status == DataDomeStatusType::UNDEFINED
|
24
25
|
event.status = DataDomeStatusType::SUCCEEDED
|
25
26
|
end
|
26
27
|
|
@@ -60,7 +61,7 @@ class DataDome
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def collect(request:, event:)
|
63
|
-
if event.status == DataDomeStatusType::UNDEFINED
|
64
|
+
if event.respond_to?(:status) && event.status == DataDomeStatusType::UNDEFINED
|
64
65
|
event.status = DataDomeStatusType::FAILED
|
65
66
|
end
|
66
67
|
|
data/lib/model/api/request.rb
CHANGED
@@ -149,7 +149,7 @@ class DataDomeHeaders
|
|
149
149
|
contentType: @content_type,
|
150
150
|
host: @host,
|
151
151
|
port: @port,
|
152
|
-
|
152
|
+
xRealIp: @x_real_ip,
|
153
153
|
xForwardedForIp: @x_forwarded_for_ip,
|
154
154
|
acceptEncoding: @accept_encoding,
|
155
155
|
acceptLanguage: @accept_language,
|
@@ -177,7 +177,7 @@ class DataDomeHeaders
|
|
177
177
|
end
|
178
178
|
|
179
179
|
class DataDomeRequest
|
180
|
-
attr_reader :module, :header, :account, :status, :session, :user
|
180
|
+
attr_reader :module, :header, :account, :status, :session, :user, :authentication, :reason
|
181
181
|
|
182
182
|
def initialize(datadome_headers)
|
183
183
|
@module = DataDomeModule.new
|
@@ -189,6 +189,8 @@ class DataDomeRequest
|
|
189
189
|
@status = {}
|
190
190
|
@session = {}
|
191
191
|
@user = {}
|
192
|
+
@authentication = {}
|
193
|
+
@reason = nil
|
192
194
|
end
|
193
195
|
|
194
196
|
def to_json(options = {})
|
@@ -199,6 +201,8 @@ class DataDomeRequest
|
|
199
201
|
status: @status,
|
200
202
|
session: @session,
|
201
203
|
user: @user,
|
204
|
+
authentication: @authentication,
|
205
|
+
reason: @reason,
|
202
206
|
}
|
203
207
|
JSON.generate(data, options)
|
204
208
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DataDomeAuthenticationMode
|
4
|
+
OTHER = "other"
|
5
|
+
BIOMETRIC = "biometric"
|
6
|
+
MAIL = "mail"
|
7
|
+
MFA = "mfa"
|
8
|
+
OTP = "otp"
|
9
|
+
PASSWORD = "password"
|
10
|
+
end
|
11
|
+
|
12
|
+
module DataDomeAuthenticationType
|
13
|
+
OTHER = "other"
|
14
|
+
LOCAL = "local"
|
15
|
+
SOCIAL = "social"
|
16
|
+
end
|
17
|
+
|
18
|
+
module DataDomeSocialProvider
|
19
|
+
OTHER = "other"
|
20
|
+
AMAZON = "amazon"
|
21
|
+
APPLE = "apple"
|
22
|
+
FACEBOOK = "facebook"
|
23
|
+
GITHUB = "github"
|
24
|
+
GOOGLE = "google"
|
25
|
+
LINKEDIN = "linkedin"
|
26
|
+
MICROSOFT = "microsoft"
|
27
|
+
TWITTER = "twitter"
|
28
|
+
YAHOO = "yahoo"
|
29
|
+
end
|
30
|
+
|
31
|
+
class DataDomeAuthentication
|
32
|
+
attr_accessor :mode, :type, :social_provider
|
33
|
+
|
34
|
+
def initialize(mode: DataDomeAuthenticationMode::OTHER, type: DataDomeAuthenticationType::OTHER, social_provider: DataDomeSocialProvider::OTHER)
|
35
|
+
@mode = mode
|
36
|
+
@type = type
|
37
|
+
@social_provider = social_provider
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_s
|
41
|
+
"DataDomeAuthentication: mode=#{@mode}, type=#{@type}, socialProvider=#{@social_provider}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_json(options = {})
|
45
|
+
{
|
46
|
+
mode: @mode,
|
47
|
+
type: @type,
|
48
|
+
socialProvider: @social_provider,
|
49
|
+
}.to_json
|
50
|
+
end
|
51
|
+
end
|
data/lib/model/events.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "./authentication"
|
4
|
+
require_relative "./session"
|
5
|
+
|
3
6
|
module DataDomeActionType
|
4
7
|
LOGIN = "login"
|
5
8
|
REGISTER = "registration"
|
9
|
+
ACCOUNT_UPDATE = "account/update"
|
10
|
+
PASSWORD_UPDATE = "password/update"
|
6
11
|
end
|
7
12
|
|
8
13
|
module DataDomeStatusType
|
@@ -11,41 +16,117 @@ module DataDomeStatusType
|
|
11
16
|
UNDEFINED = "undefined"
|
12
17
|
end
|
13
18
|
|
19
|
+
module DataDomePasswordUpdateReason
|
20
|
+
FORCED_RESET = "forcedReset"
|
21
|
+
FORGOT_PASSWORD = "forgotPassword"
|
22
|
+
USER_UPDATE = "userUpdate"
|
23
|
+
end
|
24
|
+
|
25
|
+
module DataDomePasswordUpdateStatus
|
26
|
+
ATTEMPTED = "attempted"
|
27
|
+
FAILED = "failed"
|
28
|
+
SUCCEEDED = "succeeded"
|
29
|
+
LINK_EXPIRED = "linkExpired"
|
30
|
+
end
|
31
|
+
|
32
|
+
class DataDomeUserId
|
33
|
+
attr_accessor :id
|
34
|
+
|
35
|
+
def initialize(id:)
|
36
|
+
@id = id
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s
|
40
|
+
"DataDomeUserId: id=#{@id}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_json(options = {})
|
44
|
+
{
|
45
|
+
id: @id,
|
46
|
+
}.to_json
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
14
50
|
class DataDomeEvent
|
15
|
-
attr_accessor :action, :
|
51
|
+
attr_accessor :action, :account, :authentication, :session
|
16
52
|
|
17
|
-
def initialize(action, account,
|
53
|
+
def initialize(action, account, authentication: nil, session: nil)
|
18
54
|
@action = action
|
19
55
|
@account = account
|
20
|
-
@
|
56
|
+
@authentication = authentication
|
57
|
+
@session = session
|
21
58
|
end
|
22
59
|
|
23
60
|
def merge_with(request_data)
|
24
61
|
request_data.instance_variable_set(:@account, @account)
|
25
|
-
request_data.instance_variable_set(:@
|
62
|
+
request_data.instance_variable_set(:@authentication, @authentication) if @authentication
|
63
|
+
request_data.instance_variable_set(:@session, @session) if @session
|
26
64
|
request_data
|
27
65
|
end
|
28
66
|
end
|
29
67
|
|
30
68
|
class DataDomeLoginEvent < DataDomeEvent
|
31
|
-
|
32
|
-
|
69
|
+
attr_accessor :user, :status
|
70
|
+
|
71
|
+
def initialize(account:, status: DataDomeStatusType::UNDEFINED, authentication: nil, session: nil, user: nil)
|
72
|
+
super(DataDomeActionType::LOGIN, account, authentication: authentication, session: session)
|
73
|
+
@user = user
|
74
|
+
@status = status
|
75
|
+
end
|
76
|
+
|
77
|
+
def merge_with(request_data)
|
78
|
+
super(request_data)
|
79
|
+
request_data.instance_variable_set(:@user, @user) if @user
|
80
|
+
request_data.instance_variable_set(:@status, @status)
|
81
|
+
request_data
|
33
82
|
end
|
34
83
|
end
|
35
84
|
|
36
85
|
class DataDomeRegistrationEvent < DataDomeEvent
|
37
|
-
attr_accessor :user
|
86
|
+
attr_accessor :user
|
38
87
|
|
39
|
-
def initialize(account:, user:,
|
40
|
-
super(DataDomeActionType::REGISTER, account,
|
41
|
-
@session = session
|
88
|
+
def initialize(account:, user:, authentication: nil, session: nil)
|
89
|
+
super(DataDomeActionType::REGISTER, account, authentication: authentication, session: session)
|
42
90
|
@user = user
|
43
91
|
end
|
44
92
|
|
45
93
|
def merge_with(request_data)
|
46
94
|
super(request_data)
|
47
|
-
request_data.instance_variable_set(:@session, @session)
|
48
95
|
request_data.instance_variable_set(:@user, @user)
|
49
96
|
request_data
|
50
97
|
end
|
51
98
|
end
|
99
|
+
|
100
|
+
class DataDomeAccountUpdateEvent < DataDomeEvent
|
101
|
+
attr_accessor :user
|
102
|
+
|
103
|
+
def initialize(account:, user: nil, authentication: nil, session: nil)
|
104
|
+
super(DataDomeActionType::ACCOUNT_UPDATE, account, authentication: authentication, session: session)
|
105
|
+
@user = user
|
106
|
+
end
|
107
|
+
|
108
|
+
def merge_with(request_data)
|
109
|
+
super(request_data)
|
110
|
+
request_data.instance_variable_set(:@user, @user) if @user
|
111
|
+
request_data
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class DataDomePasswordUpdateEvent < DataDomeEvent
|
116
|
+
attr_accessor :reason, :user, :status
|
117
|
+
|
118
|
+
def initialize(account:, reason: nil, status:, authentication: nil, session: nil, user: nil)
|
119
|
+
super(DataDomeActionType::PASSWORD_UPDATE, account, authentication: authentication, session: session)
|
120
|
+
@reason = reason
|
121
|
+
@user = user
|
122
|
+
@status = status
|
123
|
+
end
|
124
|
+
|
125
|
+
def merge_with(request_data)
|
126
|
+
super(request_data)
|
127
|
+
request_data.instance_variable_set(:@reason, @reason)
|
128
|
+
request_data.instance_variable_set(:@user, @user) if @user
|
129
|
+
request_data.instance_variable_set(:@status, @status)
|
130
|
+
request_data
|
131
|
+
end
|
132
|
+
end
|
data/lib/model/user.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "time"
|
4
3
|
require_relative "./address"
|
5
4
|
|
6
5
|
module DataDomeTitle
|
7
|
-
EMPTY = nil
|
8
6
|
MR = "mr"
|
9
7
|
MRS = "mrs"
|
10
8
|
MX = "mx"
|
11
9
|
end
|
12
10
|
|
13
11
|
class DataDomeUser
|
14
|
-
attr_accessor :id, :title, :first_name, :last_name, :created_at, :phone, :email, :address
|
12
|
+
attr_accessor :id, :title, :first_name, :last_name, :created_at, :phone, :email, :display_name, :description, :picture_urls, :external_urls, :address, :payment_method_updated
|
15
13
|
|
16
|
-
def initialize(id:, title: nil, first_name: nil, last_name: nil, created_at:
|
14
|
+
def initialize(id:, title: nil, first_name: nil, last_name: nil, created_at: nil, phone: nil, email: nil, display_name: nil, description: nil, picture_urls: nil, external_urls: nil, address: nil, payment_method_updated: nil)
|
17
15
|
@id = id
|
18
16
|
@title = title
|
19
17
|
@first_name = first_name
|
@@ -21,22 +19,33 @@ class DataDomeUser
|
|
21
19
|
@created_at = created_at
|
22
20
|
@phone = phone
|
23
21
|
@email = email
|
22
|
+
@display_name = display_name
|
23
|
+
@description = description
|
24
|
+
@picture_urls = picture_urls || []
|
25
|
+
@external_urls = external_urls || []
|
24
26
|
@address = address
|
27
|
+
@payment_method_updated = payment_method_updated
|
25
28
|
end
|
26
29
|
|
27
30
|
def to_s
|
28
|
-
"DataDomeUser: id=#{@id}, title=#{@title}, firstName=#{@first_name}, lastName=#{@last_name}, createdAt=#{@created_at}, phone=#{@phone}, address=#{@address}"
|
31
|
+
"DataDomeUser: id=#{@id}, title=#{@title}, firstName=#{@first_name}, lastName=#{@last_name}, createdAt=#{@created_at}, phone=#{@phone}, email=#{@email}, displayName=#{@display_name}, description=#{@description}, pictureUrls=#{@picture_urls}, externalUrls=#{@external_urls}, address=#{@address}, paymentMethodUpdated=#{@payment_method_updated}"
|
29
32
|
end
|
30
33
|
|
31
34
|
def to_json(options = {})
|
32
35
|
{
|
33
36
|
id: @id,
|
37
|
+
title: @title,
|
34
38
|
firstName: @first_name,
|
35
39
|
lastName: @last_name,
|
36
40
|
createdAt: @created_at,
|
37
41
|
phone: @phone,
|
38
42
|
email: @email,
|
39
|
-
|
43
|
+
displayName: @display_name,
|
44
|
+
description: @description,
|
45
|
+
pictureUrls: @picture_urls,
|
46
|
+
externalUrls: @external_urls,
|
47
|
+
address: @address.respond_to?(:to_json) ? JSON.parse(@address.to_json) : @address,
|
48
|
+
paymentMethodUpdated: @payment_method_updated,
|
40
49
|
}.to_json
|
41
50
|
end
|
42
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datadome_fraud_sdk_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DataDome
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- lib/model/address.rb
|
37
37
|
- lib/model/api/request.rb
|
38
38
|
- lib/model/api/response.rb
|
39
|
+
- lib/model/authentication.rb
|
39
40
|
- lib/model/events.rb
|
40
41
|
- lib/model/location.rb
|
41
42
|
- lib/model/operation.rb
|