99
1010public class VisualRegressionTracker {
1111 static final MediaType JSON = MediaType .get ("application/json; charset=utf-8" );
12- Config config ;
12+ VisualRegressionTrackerConfig visualRegressionTrackerConfig ;
1313 String buildId ;
1414 OkHttpClient client ;
1515
16- public VisualRegressionTracker (Config config ) {
17- this .config = config ;
16+ public VisualRegressionTracker (VisualRegressionTrackerConfig visualRegressionTrackerConfig ) {
17+ this .visualRegressionTrackerConfig = visualRegressionTrackerConfig ;
1818
1919 this .client = new OkHttpClient ();
2020 }
2121
2222 void startBuild () throws IOException {
2323 if (this .buildId == null ) {
2424 Map <String , String > data = new HashMap <>();
25- data .put ("projectId" , this .config .projectId );
26- data .put ("branchName" , this .config .branchName );
25+ data .put ("projectId" , this .visualRegressionTrackerConfig .projectId );
26+ data .put ("branchName" , this .visualRegressionTrackerConfig .branchName );
2727
2828 RequestBody body = RequestBody .create (new Gson ().toJson (data ), JSON );
2929
3030 Request request = new Request .Builder ()
31- .url (this .config .apiUrl .concat ("/builds" ))
32- .addHeader ("apiKey" , this .config .apiKey )
31+ .url (this .visualRegressionTrackerConfig .apiUrl .concat ("/builds" ))
32+ .addHeader ("apiKey" , this .visualRegressionTrackerConfig .apiKey )
3333 .post (body )
3434 .build ();
3535
@@ -42,7 +42,7 @@ void startBuild() throws IOException {
4242
4343 TestResultDTO submitTestRun (String name , String imageBase64 , TestRunOptions testRunOptions ) throws IOException {
4444 Map <String , Object > data = new HashMap <>();
45- data .put ("projectId" , this .config .projectId );
45+ data .put ("projectId" , this .visualRegressionTrackerConfig .projectId );
4646 data .put ("buildId" , this .buildId );
4747 data .put ("name" , name );
4848 data .put ("imageBase64" , imageBase64 );
@@ -55,8 +55,8 @@ TestResultDTO submitTestRun(String name, String imageBase64, TestRunOptions test
5555 RequestBody body = RequestBody .create (new Gson ().toJson (data ), JSON );
5656
5757 Request request = new Request .Builder ()
58- .url (this .config .apiUrl .concat ("/test" ))
59- .addHeader ("apiKey" , this .config .apiKey )
58+ .url (this .visualRegressionTrackerConfig .apiUrl .concat ("/test" ))
59+ .addHeader ("apiKey" , this .visualRegressionTrackerConfig .apiKey )
6060 .post (body )
6161 .build ();
6262
0 commit comments