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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
- Subusers API
- `pl.smsapi.exception.SmsapiErrorException` to handle API error responses
- `date_sent` to SMS/MMS send action responses
- `time_restriction` parameter for SMS send action

### Changed
- `pl.smsapi.api.UserFactory.actionAdd` marked as deprecated, use `pl.smsapi.api.action.subusers.SubusersFactory.actionAdd` instead
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/pl/smsapi/api/action/sms/SMSSend.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ public SMSSend setParam(int i, String text) {

return this;
}

/**
* Set time restriction mode.
*/
public SMSSend setTimeRestriction(String timeRestriction) {
params.put("time_restriction", timeRestriction);
return this;
}

public SMSSend setDiscountGroup(String $discountGroupName)
{
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/pl/smsapi/api/action/sms/SMSSendTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public void executeSendSmsWithOptionalFields() throws SmsapiException {
.setNormalize(true)
.setParam(1, "param")
.setParam(2, new String[]{"param1", "param2"})
.setDiscountGroup("group1");
.setDiscountGroup("group1")
.setTimeRestriction("follow");
action.client(new ClientStub());
action.proxy(requestStub);

Expand All @@ -68,6 +69,7 @@ public void executeSendSmsWithOptionalFields() throws SmsapiException {
expectedRequestPayload.put("normalize", "1");
expectedRequestPayload.put("flash", "1");
expectedRequestPayload.put("from", "test");
expectedRequestPayload.put("time_restriction", "follow");
assertEquals(expectedRequestPayload, requestStub.requestPayload);
}
}