-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathEnvironment.java
More file actions
executable file
·58 lines (43 loc) · 1.34 KB
/
Environment.java
File metadata and controls
executable file
·58 lines (43 loc) · 1.34 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
package br.com.userede.erede;
import com.google.gson.annotations.SerializedName;
public class Environment {
private static final String PRODUCTION = "https://api.userede.com.br/erede";
private static final String SANDBOX = "https://sandbox-erede.useredecloud.com.br";
private static final String VERSION = "v2";
@SerializedName("ip")
private String ip;
@SerializedName("sessionId")
private String sessionId;
@SerializedName("endpoint")
private String endpoint;
public Environment(String baseUrl) {
endpoint = String.format("%s/%s/", baseUrl, Environment.VERSION);
}
public static Environment production() {
return new Environment(Environment.PRODUCTION);
}
public static Environment sandbox() {
return new Environment(Environment.SANDBOX);
}
public String getIp() {
return ip;
}
public Environment setIp(String ip) {
this.ip = ip;
return this;
}
public String getSessionId() {
return sessionId;
}
public Environment setSessionId(String sessionId) {
this.sessionId = sessionId;
return this;
}
public String getEndpoint(String service) {
return endpoint + service;
}
public Environment setEndpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}
}