Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pulling subject, text and from fields out of JSON passed

  • Loading branch information...
commit b70e619d2716864dc277063cb343ff00650b4da5 1 parent 73d2901
@SidneyAllen authored
Showing with 16 additions and 15 deletions.
  1. +1 −1  java/pom.xml
  2. +15 −14 java/src/main/java/com/stackmob/example/SendGrid.java
View
2  java/pom.xml
@@ -74,7 +74,7 @@
<goal>single</goal>
</goals>
<configuration>
- <finalName>${project.artifactId}-${project.version}-Assembled</finalName>
+ <finalName>assembed-${project.version}</finalName>
<appendAssemblyId>true</appendAssemblyId>
<filters>
<filter>src/main/filters/${env}/${build.env}/filter-common.properties</filter>
View
29 java/src/main/java/com/stackmob/example/SendGrid.java
@@ -77,10 +77,15 @@ public ResponseToProcess execute(ProcessedAPIRequest request, SDKServiceProvider
int responseCode = 0;
String responseBody = "";
String username = "";
- String body = "";
- String url = "";
+ String subject = "";
+ String text = "";
+ String from = "";
String to = "";
String toname = "";
+
+ String body = "";
+ String url = "";
+
String api_user = API_USER;
String api_key = API_KEY;
@@ -95,9 +100,16 @@ public ResponseToProcess execute(ProcessedAPIRequest request, SDKServiceProvider
Object obj = parser.parse(request.getBody());
JSONObject jsonObject = (JSONObject) obj;
-
+
+ //We use the username passed to query the StackMob datastore
+ //and retrieve the user's name and email address
username = (String) jsonObject.get("username");
+ // The following values could be static or dynamic
+ subject = (String) jsonObject.get("subject");
+ text = (String) jsonObject.get("text");
+ from = (String) jsonObject.get("from");
+
} catch (ParseException e) {
e.printStackTrace();
}
@@ -149,17 +161,6 @@ public ResponseToProcess execute(ProcessedAPIRequest request, SDKServiceProvider
return new ResponseToProcess(HttpURLConnection.HTTP_INTERNAL_ERROR, errMap); // http 500 - internal server error
}
- // The following values could be static or dynamic
- // and could be populated with values from the StackMob datastore
- // SUBJECT - subject line for the email
- String subject = request.getParams().get("subject");
-
- // TEXT - the text of the email
- String text = request.getParams().get("text");
-
- // FROM - the text of the email
- String from = request.getParams().get("from");
-
if (subject == null || subject.equals("")) {
logger.error("Subject is missing");
}
Please sign in to comment.
Something went wrong with that request. Please try again.