From 9557c1082f6ed560cff478105bef6694c2acb2e7 Mon Sep 17 00:00:00 2001 From: Juliana Lucena Date: Fri, 5 Jul 2024 16:48:42 -0300 Subject: [PATCH] Remove `get_signup_assessment` method from the lib This endpoint was discontinued by Incognia. --- README.md | 11 ---------- lib/incognia_api/api.rb | 9 -------- spec/helpers/api_spec_helpers.rb | 13 +----------- spec/incognia_spec.rb | 36 -------------------------------- 4 files changed, 1 insertion(+), 68 deletions(-) diff --git a/README.md b/README.md index fa13233..54c1883 100644 --- a/README.md +++ b/README.md @@ -80,17 +80,6 @@ assessment = api.register_signup( # => # ``` -### Getting a Signup - -This method allows you to query the latest assessment for a given signup event, returning signup assessment, containing the risk assessment and supporting evidence: - -```ruby -assessment = api.get_signup_assessment(signup_id: "95a9fc56-f65e-436b-a87f-a1338043678f") - -# => # - -``` - ### Registering a Login This method registers a new login for the given installation and account, returning a login assessment, containing the risk assessment and supporting evidence: diff --git a/lib/incognia_api/api.rb b/lib/incognia_api/api.rb index 478bb47..fe6c53c 100644 --- a/lib/incognia_api/api.rb +++ b/lib/incognia_api/api.rb @@ -29,15 +29,6 @@ def register_signup(installation_id:, address: nil, **opts) SignupAssessment.from_hash(response.body) if response.success? end - def get_signup_assessment(signup_id:) - response = connection.request( - :get, - "v2/onboarding/signups/#{signup_id}" - ) - - SignupAssessment.from_hash(response.body) if response.success? - end - def register_login(installation_id:, account_id:, **opts) params = { type: :login, diff --git a/spec/helpers/api_spec_helpers.rb b/spec/helpers/api_spec_helpers.rb index f02a175..27ed487 100644 --- a/spec/helpers/api_spec_helpers.rb +++ b/spec/helpers/api_spec_helpers.rb @@ -9,7 +9,7 @@ def self.included(rspec) rspec.let(:unknown_login_fixture) do File.new("spec/fixtures/login-unknown.json").read end - rspec.let(:unknown_payment_fixture) do + rspec.let(:unknown_payment_fixture) do File.new("spec/fixtures/payment-unknown.json").read end rspec.let(:missing_required_params_fixture) do @@ -65,17 +65,6 @@ def stub_signup_request_500 headers: { 'Content-Type' => 'application/json' }) end - def stub_get_signup_request(signup_id:) - json_body = JSON.parse(unknown_signup_fixture, symbolize_names: true) - json_body.merge(id: signup_id) - - stub_request(:get, "https://api.incognia.com/api/v2/onboarding/signups/#{signup_id}"). - to_return( - status: 200, - body: json_body.to_json, - headers: { 'Content-Type' => 'application/json' }) - end - def stub_login_request stub_request( :post, "https://api.incognia.com/api/v2/authentication/transactions" diff --git a/spec/incognia_spec.rb b/spec/incognia_spec.rb index e8a336d..568037e 100644 --- a/spec/incognia_spec.rb +++ b/spec/incognia_spec.rb @@ -157,42 +157,6 @@ module Incognia end - describe "#get_signup_assessment" do - let(:signup_id) { 'id' } - - it "when successful returns the resource" do - stub_token_request - stub_get_signup_request(signup_id: signup_id) - - signup = api.get_signup_assessment(signup_id: signup_id) - - expected = JSON.parse(unknown_signup_fixture, symbolize_names: true) - expect(signup.id). - to eql expected[:id] - expect(signup.risk_assessment). - to eql expected[:risk_assessment] - expect_evidences_to_match(signup, expected) - end - - context "HTTP request" do - it "hits the endpoint with signup id at URL" do - stub_token_request - - stub = stub_get_signup_request(signup_id: signup_id) - stub.with( - headers: { - 'Authorization' => /Bearer.*/ - } - ) - - api.get_signup_assessment(signup_id: signup_id) - - expect(stub).to have_been_made.once - end - end - - end - describe "#register_login" do let(:installation_id) { SecureRandom.uuid } let(:account_id) { SecureRandom.uuid }