datadome_fraud_sdk_ruby 1.0.0 → 1.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: 2b8713046c4239173b65684b92fd86c95371bd74f7dfeb71ad7cfe7c8d3ba2f5
4
- data.tar.gz: 5acc8e0e5f7b878ebc92637052cd10b7fca76f20492cafc47e02741fcc2064d2
3
+ metadata.gz: 92c514d743f75302d1d5feafa93f424f0835edf132d509586bbda5ecb7a88a46
4
+ data.tar.gz: 7ede40dea73ad22e61f486122f157e977856ca11ca9e7222de4294ef4e4c7262
5
5
  SHA512:
6
- metadata.gz: 42b2be325fe412f8e21a1a0f7be4641a01568f5b3e4ee06cdde3af8c264ec4f686530d00f34877c58fc8171c62ddc68dadd2ba0cafbb94504ba1798e2f5993e4
7
- data.tar.gz: 72364626f1bfe4378696d3db32a3617a7f909642c0d18baa83f0c3cece393492321afe9830ca116aee0ea389d49459feedaf4c397538a9e566c7b57b6e1dfcd7
6
+ metadata.gz: 7d955b2b2051ecf0107fbd2a7f47d79471c6fa7774b61109c347a3a034fa1a2e1b972b08592332e89519686574f7d1c6f5468186210c3e0f0aef057f7357a882
7
+ data.tar.gz: ba94a9908561d38ef52605aedbccd8c567f8362cc188f688d4b40416b3353fec52efdef3135864830d4f304191c61ed1b23d607947f3cb3387e4bef3e14fcd53
data/lib/constants.rb CHANGED
@@ -1,2 +1,2 @@
1
- SDK_VERSION = '1.0.0'
1
+ SDK_VERSION = '1.1.0'
2
2
  SDK_NAME = 'datadome_fraud_sdk_ruby'
@@ -12,21 +12,21 @@ require_relative "model/api/response"
12
12
  class DataDome
13
13
  attr_accessor :timeout, :endpoint, :logger
14
14
 
15
- def initialize(timeout = 1500, endpoint = "account-api.datadome.co", logger = Logger.new(STDOUT))
15
+ def initialize(timeout: 1500, endpoint: "account-api.datadome.co", logger: Logger.new(STDOUT))
16
16
  @timeout = timeout
17
17
  @endpoint = endpoint
18
18
  @logger = logger
19
19
  end
20
20
 
21
- def validate(request, event)
22
- if event.status == StatusType::UNDEFINED
23
- event.status = StatusType::SUCCEEDED
21
+ def validate(request:, event:)
22
+ if event.status == DataDomeStatusType::UNDEFINED
23
+ event.status = DataDomeStatusType::SUCCEEDED
24
24
  end
25
25
 
26
26
  payload = build_payload(request, event)
27
27
 
28
28
  begin
29
- api_response = sendRequest(OperationType::VALIDATE, event.action, payload)
29
+ api_response = send_request(DataDomeOperationType::VALIDATE, event.action, payload)
30
30
 
31
31
  begin
32
32
  body = JSON.parse(api_response.body) unless api_response.body.nil?
@@ -53,15 +53,15 @@ class DataDome
53
53
  datadome_response
54
54
  end
55
55
 
56
- def collect(request, event)
57
- if event.status == StatusType::UNDEFINED
58
- event.status = StatusType::FAILED
56
+ def collect(request:, event:)
57
+ if event.status == DataDomeStatusType::UNDEFINED
58
+ event.status = DataDomeStatusType::FAILED
59
59
  end
60
60
 
61
61
  payload = build_payload(request, event)
62
62
 
63
63
  begin
64
- api_response = sendRequest(OperationType::COLLECT, event.action, payload)
64
+ api_response = send_request(DataDomeOperationType::COLLECT, event.action, payload)
65
65
 
66
66
  if api_response.success?
67
67
  datadome_response = DataDomeResponseSuccess.new(nil, DataDomeResponseStatus::OK, nil, nil, nil)
@@ -86,7 +86,7 @@ class DataDome
86
86
 
87
87
  private
88
88
 
89
- def sendRequest(operation, event, payload)
89
+ def send_request(operation, event, payload)
90
90
  api_response = client.post("/v1/" + operation + "/" + event) do |req|
91
91
  req.body = payload.to_json
92
92
  end
data/lib/model/address.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Address
3
+ class DataDomeAddress
4
4
  attr_accessor :name, :line1, :line2, :city, :countryCode, :regionCode, :zipCode
5
5
 
6
- def initialize(name = nil, line1 = nil, line2 = nil, city = nil, countryCode = nil, regionCode = nil, zipCode = nil)
6
+ def initialize(name: nil, line1: nil, line2: nil, city: nil, countryCode: nil, regionCode: nil, zipCode: nil)
7
7
  @name = name
8
8
  @line1 = line1
9
9
  @line2 = line2
@@ -14,7 +14,7 @@ class Address
14
14
  end
15
15
 
16
16
  def to_s
17
- "Address: name=#{name}, line1=#{line1}, line2=#{line2}, city=#{city}, countryCode=#{countryCode}, regionCode=#{regionCode}, zipCode=#{zipCode}"
17
+ "DataDomeAddress: name=#{name}, line1=#{line1}, line2=#{line2}, city=#{city}, countryCode=#{countryCode}, regionCode=#{regionCode}, zipCode=#{zipCode}"
18
18
  end
19
19
 
20
20
  def to_json(options = {})
@@ -11,7 +11,7 @@ module DataDomeResponseStatus
11
11
  TIMEOUT = "timeout"
12
12
  end
13
13
 
14
- class Error
14
+ class DataDomeError
15
15
  attr_accessor :field, :error
16
16
  end
17
17
 
data/lib/model/events.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ActionType
3
+ module DataDomeActionType
4
4
  LOGIN = "login"
5
5
  REGISTER = "registration"
6
6
  end
7
7
 
8
- module StatusType
8
+ module DataDomeStatusType
9
9
  SUCCEEDED = "succeeded"
10
10
  FAILED = "failed"
11
11
  UNDEFINED = "undefined"
@@ -14,7 +14,7 @@ end
14
14
  class DataDomeEvent
15
15
  attr_accessor :action, :status, :account
16
16
 
17
- def initialize(action, account, status = StatusType::UNDEFINED)
17
+ def initialize(action, account, status = DataDomeStatusType::UNDEFINED)
18
18
  @action = action
19
19
  @account = account
20
20
  @status = status
@@ -27,17 +27,17 @@ class DataDomeEvent
27
27
  end
28
28
  end
29
29
 
30
- class LoginEvent < DataDomeEvent
31
- def initialize(account, status = StatusType::UNDEFINED)
32
- super(ActionType::LOGIN, account, status)
30
+ class DataDomeLoginEvent < DataDomeEvent
31
+ def initialize(account:, status: DataDomeStatusType::UNDEFINED)
32
+ super(DataDomeActionType::LOGIN, account, status)
33
33
  end
34
34
  end
35
35
 
36
- class RegistrationEvent < DataDomeEvent
36
+ class DataDomeRegistrationEvent < DataDomeEvent
37
37
  attr_accessor :user, :session
38
38
 
39
- def initialize(account, user, session = nil, status = StatusType::UNDEFINED)
40
- super(ActionType::REGISTER, account, status)
39
+ def initialize(account:, user:, session: nil, status: DataDomeStatusType::UNDEFINED)
40
+ super(DataDomeActionType::REGISTER, account, status)
41
41
  @session = session
42
42
  @user = user
43
43
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module OperationType
3
+ module DataDomeOperationType
4
4
  VALIDATE = "validate"
5
5
  COLLECT = "collect"
6
6
  end
data/lib/model/session.rb CHANGED
@@ -5,7 +5,7 @@ require "time"
5
5
  class DataDomeSession
6
6
  attr_reader :id, :createdAt
7
7
 
8
- def initialize(id, createdAt = Time.now.iso8601)
8
+ def initialize(id:, createdAt: Time.now.iso8601)
9
9
  @id = id
10
10
  @createdAt = createdAt
11
11
  end
@@ -21,4 +21,3 @@ class DataDomeSession
21
21
  }.to_json
22
22
  end
23
23
  end
24
-
data/lib/model/user.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require "time"
4
4
  require_relative "./address"
5
5
 
6
- module Title
6
+ module DataDomeTitle
7
7
  EMPTY = nil
8
8
  MR = "mr"
9
9
  MRS = "mrs"
@@ -11,7 +11,7 @@ module Title
11
11
  end
12
12
 
13
13
  class DataDomeUser
14
- def initialize(id, title = nil, firstName = nil, lastName = nil, createdAt = Time.now.iso8601, phone = nil, email = nil, address = nil)
14
+ def initialize(id:, title: nil, firstName: nil, lastName: nil, createdAt: Time.now.iso8601, phone: nil, email: nil, address: nil)
15
15
  @id = id
16
16
  @title = title
17
17
  @firstName = firstName
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadome_fraud_sdk_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.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-04-18 00:00:00.000000000 Z
11
+ date: 2024-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: '0'
27
27
  description: DataDome Fraud Protection - Ruby SDK
28
28
  email: support@datadome.co
29
29
  executables: []