Package com.arcbees.gwtpwebsite.server.rest

Source Code of com.arcbees.gwtpwebsite.server.rest.AskForProResource

/**
* Copyright 2013 ArcBees Inc.
*
* 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.arcbees.gwtpwebsite.server.rest;

import javax.inject.Inject;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

import com.arcbees.appengine.mail.Email;
import com.arcbees.appengine.mail.EmailBuilder;
import com.arcbees.appengine.mail.EmailSender;
import com.arcbees.gwtpwebsite.server.velocity.EmailBodyGenerator;
import com.arcbees.gwtpwebsite.shared.domain.Request;
import com.arcbees.gwtpwebsite.shared.rest.PathTokens;

@Path(PathTokens.ASK_FOR_PRO)
public class AskForProResource {
    private final EmailBodyGenerator emailBodyGenerator;
    private final EmailSender emailSender;

    @Inject
    public AskForProResource(EmailBodyGenerator emailBodyGenerator,
                             EmailSender emailSender) {
        this.emailBodyGenerator = emailBodyGenerator;
        this.emailSender = emailSender;
    }

    @POST
    public void askForPro(Request request) {
        String body = emailBodyGenerator.generateBody(request);
        String subject = "GWTP Website - Professional License Request - " + request.getClientName() +
                " <" + request.getClientEmail() + ">";

        Email email = EmailBuilder.to("queenbee@arcbees.com").fromAddress("zom.bee@arcbees.com")
                .subject(subject).body(body).build();

        emailSender.send(email);
    }
}
TOP

Related Classes of com.arcbees.gwtpwebsite.server.rest.AskForProResource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.