lib/securenative/api_manager.rb in securenative-0.1.34 vs lib/securenative/api_manager.rb in securenative-0.1.35

- old
+ new

@@ -18,9 +18,15 @@ event = SecureNative::SDKEvent.new(event_options, @options) begin res = @event_manager.send_sync(event, SecureNative::Enums::ApiRoute::VERIFY) ver_result = JSON.parse(res.body) + if res.code != "200" + if @options.fail_over_strategy == SecureNative::FailOverStrategy::FAIL_OPEN + return SecureNative::VerifyResult.new(risk_level: SecureNative::Enums::RiskLevel::LOW, score: 0, triggers: []) + end + return VerifyResult.new(risk_level: SecureNative::Enums::RiskLevel::HIGH, score: 1, triggers: []) + end return VerifyResult.new(risk_level: ver_result['riskLevel'], score: ver_result['score'], triggers: ver_result['triggers']) rescue StandardError => e SecureNative::Log.debug("Failed to call verify; #{e}") end if @options.fail_over_strategy == SecureNative::FailOverStrategy::FAIL_OPEN