-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathConfiguration.java
More file actions
81 lines (68 loc) · 2.66 KB
/
Copy pathConfiguration.java
File metadata and controls
81 lines (68 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Lob
* The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors. <p> Looking for our [previous documentation](https://lob.github.io/legacy-docs/)?
*
* The version of the OpenAPI document: 1.3.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.lob.api;
import com.lob.api.auth.*;
import io.github.cdimascio.dotenv.Dotenv;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();
private final static String BASE_PATH = "https://api.lob.com/v1";
/**
* Get the default API client, which would be used when creating API
* instances without providing an API client.
*
* @return Default API client
*/
public static ApiClient getDefaultApiClient() {
return defaultApiClient;
}
/**
* Set the default API client, which would be used when creating API
* instances without providing an API client.
*
* @param apiClient API client
*/
public static void setDefaultApiClient(ApiClient apiClient) {
defaultApiClient = apiClient;
}
/**
* Set a new API client, to be used with the integration tests
* specifically grabs the test key from the env file
*
* @return Api client configured for integration tests
*/
public static ApiClient getConfigForIntegration() {
ApiClient apiClient = new ApiClient();
HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
String LOB_API_KEY = getEnvVariable("LOB_API_TEST_KEY");
apiClient.setBasePath(BASE_PATH);
basicAuth.setUsername(LOB_API_KEY);
return apiClient;
}
/**
* Set a new API client, that has an incorrect USERNAME
* to be used with integration testing
*
* @return Api client configured for with bad username
*/
public static ApiClient getBadConfigForIntegration() {
ApiClient apiClient = new ApiClient();
HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
apiClient.setBasePath(BASE_PATH);
basicAuth.setUsername("BAD USERNAME");
return apiClient;
}
private static String getEnvVariable(String key) {
Dotenv dotenv = Dotenv.configure().directory("./").ignoreIfMalformed().ignoreIfMissing().load();
return dotenv.get(key);
}
}