incognia_api 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c92b64976c39bcd601a9a7aa6901c28a3ea41e773389e23274985372b261d45
4
- data.tar.gz: 21c4bd2fc41170a8ab1d1962a2dc7be6c5fcbb7a52257743a2033af79662f16c
3
+ metadata.gz: f17e031979fde13ac3ac30d9cc3ebf9369da407eef0aec67e0313dcfa9c1ecd3
4
+ data.tar.gz: ecbd6959f1546fa24d5d85d5f7e95e8980539ab2fddca46838e46076571bc8b4
5
5
  SHA512:
6
- metadata.gz: 35919782b5b8f3182fb9130cf4c7c89c2f0f2b998c884ec173f8bbc41edded16885c3ce5a76fe0673a4eb675ba3ad1909ec087479bad85db7e25280cdedccca4
7
- data.tar.gz: b23238db561ec59ce3992944c5311f3b712362d7294b02510e85eb15eb6f8514443a9bdab96039ceead59e58052d3cd0de72912ef78d0681674d7d6108d429c1
6
+ metadata.gz: 0f9945bb733db1fb2015636f85b3342684635a027ff70d8bd493887365085b893877ca4ea77d3f8c4e937cccfd2c4cf580bcf8223505bbfdebf5b61ada4684fe
7
+ data.tar.gz: 4f85f0ab80d4f9ca47509a6ff9edf78514990de7d0d25a3cd6c8e2a90fdbc904516d554189ad29651aae120b20ee5afe61e7ecfa80bb3f0b511c0882664d0cdb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2.0] - 2024-08-26
4
+
5
+ - Removes the requirement to send installation id to register signup, login and payment
6
+
7
+ ## [1.1.0] - 2024-07-24
8
+
9
+ - Add support to passing request_token and occurred_at to #register_feedback
10
+
3
11
  ## [1.0.0] - 2024-07-05
4
12
 
5
13
  - Remove #get_signup_assessment, because the endpoint was discontinued
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- incognia_api (1.0.0)
4
+ incognia_api (1.2.0)
5
5
  faraday (~> 1.10)
6
6
  faraday_middleware (~> 1.2)
7
7
 
data/README.md CHANGED
@@ -49,14 +49,14 @@ For sandbox credentials, refer to the [API testing guide]().
49
49
 
50
50
  ### Registering a Signup
51
51
 
52
- This method registers a new signup for the given installation and address, returning a signup assessment, containing the risk assessment and supporting evidence:
52
+ This method registers a new signup for the given request token and address, returning a signup assessment, containing the risk assessment and supporting evidence:
53
53
 
54
54
  ```ruby
55
55
  address = Incognia::Address.new(line: "West 34th Street, New York City, NY 10001")
56
- installation_id = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
56
+ request_token = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
57
57
 
58
58
  assessment = api.register_signup(
59
- installation_id: installation_id,
59
+ request_token: request_token,
60
60
  address: address
61
61
  )
62
62
 
@@ -68,11 +68,11 @@ It also supports optional parameters, for example:
68
68
 
69
69
  ```ruby
70
70
  address = Incognia::Address.new(line: "West 34th Street, New York City, NY 10001")
71
- installation_id = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
71
+ request_token = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
72
72
  external_id = "7b02736a-7718-4b83-8982-f68fb6f501fa"
73
73
 
74
74
  assessment = api.register_signup(
75
- installation_id: installation_id,
75
+ request_token: request_token,
76
76
  address: address,
77
77
  external_id: external_id
78
78
  )
@@ -82,14 +82,14 @@ assessment = api.register_signup(
82
82
 
83
83
  ### Registering a Login
84
84
 
85
- This method registers a new login for the given installation and account, returning a login assessment, containing the risk assessment and supporting evidence:
85
+ This method registers a new login for the given request token and account, returning a login assessment, containing the risk assessment and supporting evidence:
86
86
 
87
87
  ```ruby
88
- installation_id = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
88
+ request_token = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
89
89
  account_id = 'account-identifier-123'
90
90
 
91
91
  assessment = api.register_login(
92
- installation_id: installation_id,
92
+ request_token: request_token,
93
93
  account_id: account_id,
94
94
  )
95
95
 
@@ -100,12 +100,12 @@ assessment = api.register_login(
100
100
  It also supports optional parameters, for example:
101
101
 
102
102
  ```ruby
103
- installation_id = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
103
+ request_token = "WlMksW+jh5GPhqWBorsV8yDihoSHHpmt+DpjJ7eYxpHhuO/5tuHTuA..."
104
104
  account_id = 'account-identifier-123'
105
105
  external_id = 'some-external-identifier'
106
106
 
107
107
  assessment = api.register_login(
108
- installation_id: installation_id,
108
+ request_token: request_token,
109
109
  account_id: account_id,
110
110
  external_id: external_id,
111
111
  eval: false # can be used to register a new login without evaluating it
@@ -116,12 +116,12 @@ assessment = api.register_login(
116
116
 
117
117
  ### Registering Payment
118
118
 
119
- This method registers a new payment for the given installation and account, returning a `hash`,
119
+ This method registers a new payment for the given request token and account, returning a `hash`,
120
120
  containing the risk assessment and supporting evidence.
121
121
 
122
122
  ```ruby
123
123
  assessment = api.register_payment(
124
- installation_id: 'installation-id',
124
+ request_token: 'request-token',
125
125
  account_id: 'account-id'
126
126
  )
127
127
 
@@ -181,7 +181,7 @@ payment_methods = [
181
181
  ]
182
182
 
183
183
  assessment = api.register_payment(
184
- installation_id: 'installation-id',
184
+ request_token: 'request-token',
185
185
  account_id: 'account-id',
186
186
  external_id: 'external-id',
187
187
  addresses: addresses,
@@ -202,12 +202,14 @@ The `expires_at` argument should be a _Time_, _DateTime_ or an date in **RFC 333
202
202
 
203
203
 
204
204
  ```ruby
205
- account_id = "cdb2cfbb-8ad8-4668-b276-5fff9bbfdc96"
206
- timestamp = DateTime.parse('2022-06-20 23:29:00 UTC-3')
205
+ request_token = 'request-token'
206
+ account_id = 'account-id'
207
+ occurred_at = DateTime.parse('2024-07-22T15:20:00Z')
207
208
 
208
209
  success = api.register_feedback(
209
- event: Incognia::Constants::FeedbackEvent::IDENTITY_FRAUD,
210
- timestamp: timestamp,
210
+ event: Incognia::Constants::FeedbackEvent::ACCOUNT_TAKEOVER,
211
+ occurred_at: occurred_at,
212
+ request_token: request_token,
211
213
  account_id: account_id
212
214
  )
213
215
 
@@ -219,9 +221,9 @@ For custom fraud, set the value of `event` with the corresponding code:
219
221
  ```ruby
220
222
  success = api.register_feedback(
221
223
  event: 'custom_fraud_name',
222
- timestamp: timestamp,
223
- account_id: account_id,
224
- installation_id: installation_id
224
+ occurred_at: occurred_at,
225
+ request_token: request_token,
226
+ account_id: account_id
225
227
  )
226
228
 
227
229
  # => true
@@ -15,8 +15,8 @@ module Incognia
15
15
  host: "https://api.incognia.com/api")
16
16
  end
17
17
 
18
- def register_signup(installation_id:, address: nil, **opts)
19
- params = { installation_id: installation_id }
18
+ def register_signup(request_token: nil, address: nil, **opts)
19
+ params = { request_token: request_token }.compact
20
20
  params.merge!(opts)
21
21
  params.merge!(address&.to_hash) if address
22
22
 
@@ -29,12 +29,12 @@ module Incognia
29
29
  SignupAssessment.from_hash(response.body) if response.success?
30
30
  end
31
31
 
32
- def register_login(installation_id:, account_id:, **opts)
32
+ def register_login(account_id:, request_token: nil, **opts)
33
33
  params = {
34
34
  type: :login,
35
- installation_id: installation_id,
36
35
  account_id: account_id,
37
- }
36
+ request_token: request_token
37
+ }.compact
38
38
  params.merge!(opts)
39
39
 
40
40
  response = connection.request(
@@ -46,11 +46,16 @@ module Incognia
46
46
  LoginAssessment.from_hash(response.body) if response.success?
47
47
  end
48
48
 
49
- def register_feedback(event:, timestamp: nil, expires_at: nil, **ids)
49
+ def register_feedback(event:, occurred_at: nil, expires_at: nil, timestamp: nil, **ids)
50
+ if !timestamp.nil?
51
+ warn("Deprecation warning: use occurred_at instead of timestamp")
52
+ end
53
+
50
54
  timestamp = timestamp.strftime('%s%L') if timestamp.respond_to? :strftime
55
+ occurred_at = occurred_at.to_datetime.rfc3339 if occurred_at.respond_to? :to_datetime
51
56
  expires_at = expires_at.to_datetime.rfc3339 if expires_at.respond_to? :to_datetime
52
57
 
53
- params = { event: event, timestamp: timestamp&.to_i, expires_at: expires_at }.compact
58
+ params = { event: event, timestamp: timestamp&.to_i, occurred_at: occurred_at, expires_at: expires_at }.compact
54
59
  params.merge!(ids)
55
60
 
56
61
  response = connection.request(
@@ -62,8 +67,12 @@ module Incognia
62
67
  response.success?
63
68
  end
64
69
 
65
- def register_payment(installation_id:, account_id:, **opts)
66
- params = { installation_id: installation_id, account_id: account_id, type: :payment }
70
+ def register_payment(account_id:, request_token: nil, **opts)
71
+ params = {
72
+ type: :payment,
73
+ account_id: account_id,
74
+ request_token: request_token
75
+ }.compact
67
76
  params.merge!(opts)
68
77
 
69
78
  response = connection.request(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Incognia
4
- VERSION = "1.0.0"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: incognia_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Cavalcanti
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.4.19
95
+ rubygems_version: 3.1.6
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Official Ruby lib for communicating with Incognia API