33require 'campact_user_service'
44require 'faraday/detailed_logger'
55
6+ service_host = ENV [ 'SERVICE_HOST' ] || 'weact-adapter.staging.campact.de'
7+
68def instrument_connection_with_extended_logging ( client )
79 default_options = {
8- ssl : { verify : true } ,
10+ ssl : { verify : false } ,
911 headers : {
1012 'Accept' => "application/json;q=0.1" ,
1113 'Accept-Charset' => "utf-8" ,
@@ -29,7 +31,7 @@ def instrument_connection_with_extended_logging(client)
2931# Pick which API to connect to
3032# 1 for session
3133# 2 for user
32- puts "Which user service are you going to use?\n \t 1) session\n \t 2) user"
34+ puts "Which user service are you going to use?\n \t 1) session\n \t 2) user\n \t 3) prefill forms "
3335option = gets . chomp
3436
3537# Get TOTP credentials
@@ -57,7 +59,7 @@ def instrument_connection_with_extended_logging(client)
5759 token ,
5860 'campact-staging-session' ,
5961 {
60- host : 'weact-adapter.staging.campact.de' ,
62+ host : service_host ,
6163 topt_authorization : { user : username , secret : secret }
6264 }
6365 )
@@ -67,7 +69,15 @@ def instrument_connection_with_extended_logging(client)
6769 account = CampactUserService . account (
6870 account_id ,
6971 {
70- host : 'weact-adapter.staging.campact.de' ,
72+ host : service_host ,
73+ topt_authorization : { user : username , secret : secret }
74+ }
75+ )
76+ when '3'
77+ puts "I'll need a user account ID. In practice I won't need this here because it can be derived through the session token"
78+ account_id = gets . chomp
79+ prefill_forms = CampactUserService . prefill_forms ( account_id , {
80+ host : service_host ,
7181 topt_authorization : { user : username , secret : secret }
7282 }
7383 )
0 commit comments