datadome_fraud_sdk_ruby 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2434a89b8290f901080492cb9491bfa2c56cf62da19504d1eb6ae987d411fdb
4
- data.tar.gz: 121d6dbc02235af5e37c71a7acf58ce65bc1c8e3d65df37aea5e98ac115b8752
3
+ metadata.gz: fff528a204778f50d85c8eccd4c202a66d94a24109f994cfc5cd3a64c53d0bdb
4
+ data.tar.gz: 49bd243556c8c8b756d7f738cb9cf969f1c080a0d960dc208970d0c29509ee13
5
5
  SHA512:
6
- metadata.gz: 78b9a208bff8a41ea879cc4e70584f63156af5892b8cc2402647d112224902f071bc98b769903aa445ce5afebdde5d316de7064b1123028929a148cc63a4bce1
7
- data.tar.gz: bebb991f6d5bd9f9c1faef493473e145cef3f4755b0633e26671d604e6ee0d39413d3f5f7c30c24adea391d52ce0d11364693de07f9c93841874a54a5a774445
6
+ metadata.gz: c6030c2e8c3ccca6d88b60ff5814795d45f0313f613103fdc987d46ca5cd376557aa1a44c75e1f9361e076a38dcd164166ee27b375c2db20bcdf63b4a7c969d2
7
+ data.tar.gz: 565a4385c6367b9d5a0f6e46d9cc4cd1c651083262e02fe521b3a9a88eca0fa94819880ed59f44765892fe1fb3cfabb7272336ead08e96c8dc2d3e0c9cd00ebb
data/lib/constants.rb CHANGED
@@ -1,2 +1,2 @@
1
- SDK_VERSION = '2.0.0'
1
+ SDK_VERSION = '2.1.0'
2
2
  SDK_NAME = 'datadome_fraud_sdk_ruby'
@@ -37,7 +37,7 @@ class DataDome
37
37
  end
38
38
 
39
39
  if api_response.success?
40
- datadome_response = DataDomeResponseSuccess.new(DataDomeResponseAction::ALLOW, DataDomeResponseStatus::OK, body["reasons"], body["ip"], DataDomeLocation.new(location: body["location"]))
40
+ datadome_response = DataDomeResponseSuccess.new(DataDomeResponseAction::ALLOW, body["score"], DataDomeResponseStatus::OK, body["reasons"], body["ip"], DataDomeLocation.new(location: body["location"]))
41
41
  if body["action"] === DataDomeResponseAction::DENY
42
42
  datadome_response.action = DataDomeResponseAction::DENY
43
43
  end
@@ -65,7 +65,7 @@ class DataDome
65
65
  api_response = send_request(DataDomeOperationType::COLLECT, event.action, payload)
66
66
 
67
67
  if api_response.success?
68
- datadome_response = DataDomeResponseSuccess.new(nil, DataDomeResponseStatus::OK, nil, nil, nil)
68
+ datadome_response = DataDomeResponseSuccess.new(nil, nil, DataDomeResponseStatus::OK, nil, nil, nil)
69
69
  else
70
70
  begin
71
71
  body = JSON.parse(api_response.body)
@@ -21,20 +21,22 @@ class DataDomeError
21
21
  end
22
22
 
23
23
  class DataDomeResponse
24
- attr_accessor :action, :status
24
+ attr_accessor :action, :score, :status
25
25
 
26
- def initialize(action, status)
26
+ def initialize(action, score, status)
27
27
  @action = action
28
+ @score = score
28
29
  @status = status
29
30
  end
30
31
 
31
32
  def to_s
32
- "DataDomeResponse: action=#{@action}, status=#{@status}"
33
+ "DataDomeResponse: action=#{@action}, score=#{@score}, status=#{@status}"
33
34
  end
34
35
 
35
36
  def to_json(options = {})
36
37
  {
37
38
  action: @action,
39
+ score: @score,
38
40
  status: @status,
39
41
  }.to_json
40
42
  end
@@ -43,20 +45,21 @@ end
43
45
  class DataDomeResponseSuccess < DataDomeResponse
44
46
  attr_reader :ip, :reasons, :location
45
47
 
46
- def initialize(action, status, reasons, ip, location)
47
- super(action, status)
48
+ def initialize(action, score, status, reasons, ip, location)
49
+ super(action, score, status)
48
50
  @reasons = reasons
49
51
  @ip = ip
50
52
  @location = location
51
53
  end
52
54
 
53
55
  def to_s
54
- "DataDomeResponseSuccess: action=#{@action}, status=#{@status}, reasons=#{@reasons}, ip=#{@ip}, location=#{@location}"
56
+ "DataDomeResponseSuccess: action=#{@action}, score=#{@score}, status=#{@status}, reasons=#{@reasons}, ip=#{@ip}, location=#{@location}"
55
57
  end
56
58
 
57
59
  def to_json(options = {})
58
60
  {
59
61
  action: @action,
62
+ score: @score,
60
63
  status: @status,
61
64
  reasons: @reasons,
62
65
  ip: @ip,
@@ -69,18 +72,19 @@ class DataDomeResponseError < DataDomeResponse
69
72
  attr_reader :message, :errors
70
73
 
71
74
  def initialize(action, status, message, errors)
72
- super(action, status)
75
+ super(action, nil, status)
73
76
  @message = message
74
77
  @errors = errors
75
78
  end
76
79
 
77
80
  def to_s
78
- "DataDomeResponseError: action=#{@action}, status=#{@status}, message=#{@message}, errors=#{@errors}"
81
+ "DataDomeResponseError: action=#{@action}, score=#{@score}, status=#{@status}, message=#{@message}, errors=#{@errors}"
79
82
  end
80
83
 
81
84
  def to_json(options = {})
82
85
  {
83
86
  action: @action,
87
+ score: @score,
84
88
  status: @status,
85
89
  message: @message,
86
90
  errors: @errors,
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.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DataDome
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2024-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday