incognia_api 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: 3fb783b99b2bfd7a392bc8208308f946ad62aaf2aa538bdfa291e86ac5b86d5a
4
- data.tar.gz: 0aa4f32696dfffe2f15deecd250d4faf4118ccd647b293d10b8fe88b3cb0ed07
3
+ metadata.gz: a52bbb4d602bec60845df1106450e7d4642f55cc993635fe67abf05bb1e4faf3
4
+ data.tar.gz: 88daa93221f7d5901ae3235e7da5175a0a2542e7778543f713687b34d4c49d28
5
5
  SHA512:
6
- metadata.gz: '074959772f96adda32ab81e8b21ae024d1cd820c90e2e81997e2abd878c86b50967ce6131ff44bc55764c9d1140de4ecb5b4889a0de6f862bb7f156e91b7f1e8'
7
- data.tar.gz: 34638c23171aa08dc79b8141f036275b843286225871c2d8f138fd2abcca821594d31d9f76c03c030e9d420a30f071c96b01b03a846b0b7ad0c1a44a7856c639
6
+ metadata.gz: ee85936265c871bb6d76a1b10f4c2959d7e2ce9bc3c5df5eba102e5f4a3a1b2b33f35b79636db0b12e79955177dd8733d70e4e5cb8c32a47560f112ac6f3839f
7
+ data.tar.gz: a9c0b9a25f6b06931d6bc14e0fabb6d4e068d774e9c526e28bf6a66ac5d125b8c2549bee872f6f8e50d6a4781a3ca79a7338ce11e50784963d891c623fec62f0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [2.1.0] - 2025-05-09
4
+
5
+ - Add support for passing an optional location parameter to register logins and payments
6
+
3
7
  ## [2.0.0] - 2024-11-12
4
8
 
5
9
  - Remove support for instance usage of Incognia::Api
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- incognia_api (2.0.0)
4
+ incognia_api (2.1.0)
5
5
  faraday (~> 1.10)
6
6
  faraday_middleware (~> 1.2)
7
7
 
@@ -12,7 +12,7 @@ module Incognia
12
12
  def register_signup(request_token: nil, address: nil, **opts)
13
13
  params = { request_token: request_token }.compact
14
14
  params.merge!(opts)
15
- params.merge!(address&.to_hash) if address
15
+ params.merge!(address.to_hash) if address
16
16
 
17
17
  response = connection.request(
18
18
  :post,
@@ -23,12 +23,13 @@ module Incognia
23
23
  SignupAssessment.from_hash(response.body) if response.success?
24
24
  end
25
25
 
26
- def register_login(account_id:, request_token: nil, **opts)
26
+ def register_login(account_id:, request_token: nil, location: nil, **opts)
27
27
  params = {
28
28
  type: :login,
29
29
  account_id: account_id,
30
30
  request_token: request_token
31
31
  }.compact
32
+ params.merge!(location: location.to_hash) if location
32
33
  params.merge!(opts)
33
34
 
34
35
  response = connection.request(
@@ -56,12 +57,13 @@ module Incognia
56
57
  response.success?
57
58
  end
58
59
 
59
- def register_payment(account_id:, request_token: nil, **opts)
60
+ def register_payment(account_id:, request_token: nil, location: nil, **opts)
60
61
  params = {
61
62
  type: :payment,
62
63
  account_id: account_id,
63
64
  request_token: request_token
64
65
  }.compact
66
+ params.merge!(location: location.to_hash) if location
65
67
  params.merge!(opts)
66
68
 
67
69
  response = connection.request(
@@ -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 = "2.0.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: 2.0.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