forked from ringcentral/ringcentral-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMmsTest.java
More file actions
48 lines (41 loc) · 1.75 KB
/
MmsTest.java
File metadata and controls
48 lines (41 loc) · 1.75 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
package com.ringcentral;
import com.ringcentral.definitions.Attachment;
import com.ringcentral.definitions.CreateMMSMessage;
import com.ringcentral.definitions.GetSMSMessageInfoResponse;
import com.ringcentral.definitions.MessageStoreCallerInfoRequest;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class MmsTest {
@Test
public void sendMms() throws IOException, RestException {
RestClient rc = new RestClient(
System.getenv("RINGCENTRAL_CLIENT_ID"),
System.getenv("RINGCENTRAL_CLIENT_SECRET"),
System.getenv("RINGCENTRAL_SERVER_URL")
);
rc.authorize(System.getenv("RINGCENTRAL_JWT_TOKEN"));
GetSMSMessageInfoResponse response = rc.restapi().account().extension().mms().post(
new CreateMMSMessage()
.text("hello world")
.from(new MessageStoreCallerInfoRequest().phoneNumber(System.getenv("RINGCENTRAL_SENDER")))
.to(new MessageStoreCallerInfoRequest[]{
new MessageStoreCallerInfoRequest().phoneNumber(System.getenv("RINGCENTRAL_RECEIVER"))
})
.attachments(
new Attachment[]{
new Attachment()
.filename("test.png")
.contentType("image/png")
.content(Files.readAllBytes(Paths.get("./src/test/resources/test.png")))
})
);
assertNotNull(response);
assertNotNull(response.subject);
assertTrue(response.subject.contains("hello world"));
rc.revoke();
}
}