incognia_api 1.3.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: a57edb1d744307af54b8b03d93f7b607f919cf41a66f71d92e3df45db1569b13
4
- data.tar.gz: e572c70ff386ddb53c47a7921ff4b9ad1439a27188322c23d2098af1d2f77e03
3
+ metadata.gz: a52bbb4d602bec60845df1106450e7d4642f55cc993635fe67abf05bb1e4faf3
4
+ data.tar.gz: 88daa93221f7d5901ae3235e7da5175a0a2542e7778543f713687b34d4c49d28
5
5
  SHA512:
6
- metadata.gz: 942653d86e52ced892b20eaf9684fc0ed43535742f6d265c5b886caa5491bfdaedc56521d38c5ae8ed142d4f8196a13ee117d632c3dd7906977e8bdc3ff2687a
7
- data.tar.gz: 15f3d172105df2645d60f94850abee3e280eb5ae425431e9409fb782eb49de21f1003c8d8fe6f8b7ae19e870c9738da97e980631adf8133c12f29ff021578a59
6
+ metadata.gz: ee85936265c871bb6d76a1b10f4c2959d7e2ce9bc3c5df5eba102e5f4a3a1b2b33f35b79636db0b12e79955177dd8733d70e4e5cb8c32a47560f112ac6f3839f
7
+ data.tar.gz: a9c0b9a25f6b06931d6bc14e0fabb6d4e068d774e9c526e28bf6a66ac5d125b8c2549bee872f6f8e50d6a4781a3ca79a7338ce11e50784963d891c623fec62f0
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [1.3.0] - 2024-10-30
3
+ ## [2.1.0] - 2025-05-09
4
+
5
+ - Add support for passing an optional location parameter to register logins and payments
6
+
7
+ ## [2.0.0] - 2024-11-12
8
+
9
+ - Remove support for instance usage of Incognia::Api
10
+ - Remove invalid feedback types
11
+ - Remove support for sending feedback timestamp
12
+
13
+ ## [1.3.0] - 2024-11-12
4
14
 
5
15
  - Add support for general configuration and use Incognia::Api as a static class
6
16
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- incognia_api (1.3.0)
4
+ incognia_api (2.1.0)
5
5
  faraday (~> 1.10)
6
6
  faraday_middleware (~> 1.2)
7
7
 
data/README.md CHANGED
@@ -198,7 +198,7 @@ assessment = Incognia::Api.register_payment(
198
198
 
199
199
  This method registers a feedback event for the given identifiers (optional arguments), returning true when success.
200
200
 
201
- The `timestamp` argument should be a _Time_, _DateTime_ or an _Integer_ being the timestamp in milliseconds.
201
+ The `occurred_at` argument should be a _Time_, _DateTime_ or an date in **RFC 3339** format.
202
202
 
203
203
  The `expires_at` argument should be a _Time_, _DateTime_ or an date in **RFC 3339** format.
204
204
 
@@ -5,31 +5,14 @@ require 'faraday_middleware'
5
5
 
6
6
  module Incognia
7
7
  class Api
8
- # business layer: uses the Client.instance to build domain objects
9
- # raises missing parameters errors
10
-
11
- def initialize(client_id:, client_secret:)
12
- Incognia.configure(client_id: client_id, client_secret: client_secret)
13
-
14
- warn("Deprecation warning: The Incognia::Api instance will be removed. " +
15
- "Please set up with `Incognia.configure` and use class methods instead.")
16
- end
17
-
18
- def register_signup(**args); self.class.register_signup(**args) end
19
- def register_login(**args); self.class.register_login(**args) end
20
- def register_feedback(**args); self.class.register_feedback(**args) end
21
- def register_payment(**args); self.class.register_payment(**args) end
22
- def connection
23
- warn("Deprecation warning: #connection and .connection are deprecated and will be private.")
24
-
25
- self.class.connection
26
- end
27
-
28
8
  class << self
9
+ # business layer: uses the Client.instance to build domain objects
10
+ # raises missing parameters errors
11
+
29
12
  def register_signup(request_token: nil, address: nil, **opts)
30
13
  params = { request_token: request_token }.compact
31
14
  params.merge!(opts)
32
- params.merge!(address&.to_hash) if address
15
+ params.merge!(address.to_hash) if address
33
16
 
34
17
  response = connection.request(
35
18
  :post,
@@ -40,12 +23,13 @@ module Incognia
40
23
  SignupAssessment.from_hash(response.body) if response.success?
41
24
  end
42
25
 
43
- def register_login(account_id:, request_token: nil, **opts)
26
+ def register_login(account_id:, request_token: nil, location: nil, **opts)
44
27
  params = {
45
28
  type: :login,
46
29
  account_id: account_id,
47
30
  request_token: request_token
48
31
  }.compact
32
+ params.merge!(location: location.to_hash) if location
49
33
  params.merge!(opts)
50
34
 
51
35
  response = connection.request(
@@ -57,16 +41,11 @@ module Incognia
57
41
  LoginAssessment.from_hash(response.body) if response.success?
58
42
  end
59
43
 
60
- def register_feedback(event:, occurred_at: nil, expires_at: nil, timestamp: nil, **ids)
61
- if !timestamp.nil?
62
- warn("Deprecation warning: use occurred_at instead of timestamp")
63
- end
64
-
65
- timestamp = timestamp.strftime('%s%L') if timestamp.respond_to? :strftime
44
+ def register_feedback(event:, occurred_at: nil, expires_at: nil, **ids)
66
45
  occurred_at = occurred_at.to_datetime.rfc3339 if occurred_at.respond_to? :to_datetime
67
46
  expires_at = expires_at.to_datetime.rfc3339 if expires_at.respond_to? :to_datetime
68
47
 
69
- params = { event: event, timestamp: timestamp&.to_i, occurred_at: occurred_at, expires_at: expires_at }.compact
48
+ params = { event: event, occurred_at: occurred_at, expires_at: expires_at }.compact
70
49
  params.merge!(ids)
71
50
 
72
51
  response = connection.request(
@@ -78,12 +57,13 @@ module Incognia
78
57
  response.success?
79
58
  end
80
59
 
81
- def register_payment(account_id:, request_token: nil, **opts)
60
+ def register_payment(account_id:, request_token: nil, location: nil, **opts)
82
61
  params = {
83
62
  type: :payment,
84
63
  account_id: account_id,
85
64
  request_token: request_token
86
65
  }.compact
66
+ params.merge!(location: location.to_hash) if location
87
67
  params.merge!(opts)
88
68
 
89
69
  response = connection.request(
@@ -1,16 +1,13 @@
1
1
  module Incognia
2
2
  module Constants
3
3
  module FeedbackEvent
4
+ ACCOUNT_ALLOWED = 'account_allowed'.freeze
4
5
  ACCOUNT_TAKEOVER = 'account_takeover'.freeze
5
- CHALLENGE_FAILED = 'challenge_failed'.freeze
6
- CHALLENGE_PASSED = 'challenge_passed'.freeze
7
6
  CHARGEBACK = 'chargeback'.freeze
8
7
  CHARGEBACK_NOTIFICATION = 'chargeback_notification'.freeze
9
- IDENTITY_FRAUD = 'identity_fraud'.freeze
10
- MPOS_FRAUD = 'mpos_fraud'.freeze
11
- PASSWORD_CHANGE_FAILED = 'password_change_failed'.freeze
12
- PASSWORD_CHANGED_SUCCESSFULLY = 'password_changed_successfully'.freeze
13
8
  PROMOTION_ABUSE = 'promotion_abuse'.freeze
9
+ DEVICE_ALLOWED = 'device_allowed'.freeze
10
+ IDENTITY_FRAUD = 'identity_fraud'.freeze
14
11
  RESET = 'reset'.freeze
15
12
  VERIFIED = 'verified'.freeze
16
13
 
@@ -18,7 +15,12 @@ module Incognia
18
15
  SIGNUP_DECLINED = 'signup_declined'.freeze
19
16
 
20
17
  LOGIN_ACCEPTED = 'login_accepted'.freeze
18
+ LOGIN_ACCEPTED_BY_DEVICE_VERIFICATION = 'login_accepted_by_device_verification'.freeze
19
+ LOGIN_ACCEPTED_BY_FACIAL_BIOMETRICS = 'login_accepted_by_facial_biometrics'.freeze
20
+ LOGIN_ACCEPTED_BY_MANUAL_REVIEW = 'login_accepted_by_manual_review'.freeze
21
21
  LOGIN_DECLINED = 'login_declined'.freeze
22
+ LOGIN_DECLINED_BY_FACIAL_BIOMETRICS = 'login_declined_by_facial_biometrics'.freeze
23
+ LOGIN_DECLINED_BY_MANUAL_REVIEW = 'login_declined_by_manual_review'.freeze
22
24
 
23
25
  PAYMENT_ACCEPTED = 'payment_accepted'.freeze
24
26
  PAYMENT_ACCEPTED_BY_CONTROL_GROUP = 'payment_accepted_by_control_group'.freeze
@@ -0,0 +1,23 @@
1
+ require 'time'
2
+
3
+ module Incognia
4
+ class Location
5
+ attr_reader :latitude, :longitude, :collected_at
6
+
7
+ def initialize(latitude:, longitude:, collected_at: nil)
8
+ @latitude = latitude
9
+ @longitude = longitude
10
+ @collected_at = collected_at
11
+ end
12
+
13
+ def to_hash
14
+ location = {
15
+ latitude: latitude,
16
+ longitude: longitude,
17
+ collected_at: collected_at.respond_to?(:to_datetime) ? collected_at.to_datetime.rfc3339 : collected_at,
18
+ }.compact
19
+
20
+ location
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Incognia
4
- VERSION = "1.3.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/lib/incognia_api.rb CHANGED
@@ -6,6 +6,7 @@ require_relative "incognia_api/client"
6
6
  require_relative "incognia_api/util"
7
7
  require_relative "incognia_api/address"
8
8
  require_relative "incognia_api/api"
9
+ require_relative "incognia_api/location"
9
10
 
10
11
  require_relative "incognia_api/resources/api_resource"
11
12
  require_relative "incognia_api/resources/signup_assessment"
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.3.0
4
+ version: 2.1.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-11-12 00:00:00.000000000 Z
11
+ date: 2025-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -65,6 +65,7 @@ files:
65
65
  - lib/incognia_api/client.rb
66
66
  - lib/incognia_api/configuration.rb
67
67
  - lib/incognia_api/constants/feedback_event.rb
68
+ - lib/incognia_api/location.rb
68
69
  - lib/incognia_api/resources/api_resource.rb
69
70
  - lib/incognia_api/resources/credentials.rb
70
71
  - lib/incognia_api/resources/login_assessment.rb