Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/com/box/sdk/BoxCollaboration.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public class Info extends BoxResource.Info {
private Date acknowledgedAt;
private BoxFolder.Info item;
private BoxFile.Info fileItem;
private String inviteEmail;
private boolean canViewPath;

/**
Expand Down Expand Up @@ -269,6 +270,14 @@ public boolean getCanViewPath() {
return this.canViewPath;
}

/**
* The email address used to invite an un-registered collaborator, if they are not a registered user.
* @return the email for the un-registed collaborator.
*/
public String getInviteEmail() {
return this.inviteEmail;
}

/**
* Gets the status of the collaboration.
*
Expand Down Expand Up @@ -396,6 +405,9 @@ protected void parseJSONMember(JsonObject.Member member) {
} else if (memberName.equals("can_view_path")) {
this.canViewPath = value.asBoolean();

} else if (memberName.equals("invite_email")) {
this.inviteEmail = value.asString();

} else if (memberName.equals("item")) {
JsonObject folderJSON = value.asObject();
if (this.item == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "collaboration",
"id": "12345",
"invite_email": "example@test.com"
}
20 changes: 20 additions & 0 deletions src/test/java/com/box/sdk/BoxCollaborationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,24 @@ public void testGetAccessibleLoginSucceeds() throws IOException {

Assert.assertEquals(accessiblyByLogin, collabInfo.getAccessibleBy().getLogin());
}

@Test
@Category(UnitTest.class)
public void testGetInviteEmailSucceeds() throws IOException {
String result = "";
final String collabID = "12345";
final String inviteEmail = "example@test.com";
final String getCollaborationURL = "/collaborations/" + collabID;

result = TestConfig.getFixture("BoxCollaboration/GetInviteEmailAttributesOnCollaboration200");

WIRE_MOCK_CLASS_RULE.stubFor(WireMock.get(WireMock.urlPathEqualTo(getCollaborationURL))
.willReturn(WireMock.aResponse()
.withHeader("Content-Type", "application/json")
.withBody(result)));

BoxCollaboration.Info collabInfo = new BoxCollaboration(this.api, collabID).getInfo("invite_email");

Assert.assertEquals(inviteEmail, collabInfo.getInviteEmail());
}
}