com.cosmicpush.pub.push.EmailToSmsPush Maven / Gradle / Ivy
/*
* Copyright (c) 2014 Jacob D. Parr
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cosmicpush.pub.push;
import com.cosmicpush.pub.common.*;
import com.cosmicpush.pub.internal.*;
import com.fasterxml.jackson.annotation.*;
import java.io.Serializable;
@JsonIgnoreProperties(ignoreUnknown = true)
public class EmailToSmsPush implements Push, Serializable {
private final String fromAddress;
private final String toAddress;
private final String message;
private final String callbackUrl;
private final PushType pushType = PushType.emailToSms;
@JsonCreator
public EmailToSmsPush(@JsonProperty("toAddress") String toAddress,
@JsonProperty("fromAddress") String fromAddress,
@JsonProperty("message") String message,
@JsonProperty("callbackUrl") String callbackUrl) {
this.message = message;
this.toAddress = toAddress;
this.fromAddress = fromAddress;
this.callbackUrl = callbackUrl;
}
@Override
public String getCallbackUrl() {
return callbackUrl;
}
@Override
public PushType getPushType() {
return pushType;
}
public String getFromAddress() {
return fromAddress;
}
public String getMessage() {
return message;
}
public String getToAddress() {
return toAddress;
}
@Override
@JsonIgnore
public String getEndPoint() {
return EndPoints.PUSH_EMAIL_TO_SMS;
}
@Override
public RequestErrors validate(RequestErrors errors) {
ValidationUtils.requireValue(errors, toAddress, "The \"to\" address must be specified.");
ValidationUtils.requireValue(errors, fromAddress, "The \"from\" address must be specified.");
ValidationUtils.requireValue(errors, message, "The SMS message must be specified.");
return errors;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy