Skip to content

Commit

Permalink
change package name.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamraphson committed Aug 30, 2016
1 parent 05f521f commit 8d9f56c
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.iamraphson.jusibe.core</groupId>
<groupId>com.unicodelabs.jusibe.core</groupId>
<artifactId>jusibe-java-lib</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
Expand Down
Expand Up @@ -3,12 +3,12 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.iamraphson.jusibe.core;
package com.unicodelabs.jusibe.core;

import com.google.common.base.Strings;
import com.iamraphson.jusibe.core.connection.JusibeClient;
import com.iamraphson.jusibe.core.exceptions.IsNullException;
import com.iamraphson.jusibe.core.utils.JusibeResponse;
import com.unicodelabs.jusibe.core.connection.JusibeClient;
import com.unicodelabs.jusibe.core.exceptions.IsNullException;
import com.unicodelabs.jusibe.core.utils.JusibeResponse;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Map;
Expand Down Expand Up @@ -57,7 +57,7 @@ public Jusibe(String publicKey, String accessToken) throws IsNullException, Malf
* Send SMS using the Jusibe API
* @param payload
* @return
* @throws com.iamraphson.jusibe.core.exceptions.IsNullException
* @throws com.unicodelabs.jusibe.core.exceptions.IsNullException
* @throws java.net.MalformedURLException
*/
public JusibeResponse sendSMS(Map<String, String> payload)
Expand All @@ -84,7 +84,7 @@ public JusibeResponse checkAvailableCredits() throws IOException{
* Check the delivery status of a sent SMS
* @param messageID
* @return
* @throws com.iamraphson.jusibe.core.exceptions.IsNullException
* @throws com.unicodelabs.jusibe.core.exceptions.IsNullException
* @throws java.io.IOException
*/
public JusibeResponse checkDeliveryStatus(String messageID) throws IsNullException, IOException{
Expand Down
Expand Up @@ -3,9 +3,9 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.iamraphson.jusibe.core.connection;
package com.unicodelabs.jusibe.core.connection;

import com.iamraphson.jusibe.core.utils.JusibeResponse;
import com.unicodelabs.jusibe.core.utils.JusibeResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Expand Down
87 changes: 87 additions & 0 deletions src/main/java/com/unicodelabs/jusibe/core/example/App.java
@@ -0,0 +1,87 @@
package com.unicodelabs.jusibe.core.example;



import com.unicodelabs.jusibe.core.Jusibe;
import com.unicodelabs.jusibe.core.exceptions.IsNullException;
import com.unicodelabs.jusibe.core.utils.JusibeResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

/**
* Hello world!
*
*/
public class App
{
public static final String PUBLIC_KEY = "09de5bec3937d2d032d8a75b41f9081b";
public static final String ACCESS_TOKEN = "68501b2b40767fc51e4f936d7db40fc0";

public static void main( String[] args ){
try {
final Jusibe client = new Jusibe(PUBLIC_KEY, ACCESS_TOKEN);
final Map<String, String> smsParams = new HashMap<String, String>();

smsParams.put("to", "08091167643"); // Replace with a valid phone number
smsParams.put("from", "iamraphson"); // Replace with a valid phone number in your account
smsParams.put("message", "Welcome to Jusibe JAVA lib");

JusibeResponse smsResponse = client.sendSMS(smsParams);
System.out.println(smsResponse.toString());

JSONObject smsResultObject =
(JSONObject)new JSONParser().parse(smsResponse.getResponseMessage());
if(smsResponse.getResponseCode() == 200){
System.out.println("your SMS Message ID is " + smsResultObject.get("message_id"));
System.out.println("your SMS Status is " + smsResultObject.get("status"));
System.out.println("SMS credit used is " + smsResultObject.get("sms_credits_used"));
System.out.println("your request speed is " + smsResultObject.get("request_speed"));
} else {
System.out.println(smsResultObject.get("error"));
}


JusibeResponse balResponse = client.checkAvailableCredits();
System.out.println(balResponse.toString());
JSONObject balResultObject =
(JSONObject)new JSONParser().parse(balResponse.getResponseMessage());
if(balResponse.getResponseCode() == 200){
System.out.println("your SMS balance is " + balResultObject.get("sms_credits"));
System.out.println("your request speed is " + balResultObject.get("request_speed"));
} else {
System.out.println(balResultObject.get("error"));
}


JusibeResponse deliveryResponse =
client.checkDeliveryStatus("w719zxz58q");
System.out.println(deliveryResponse.toString());
JSONObject deliveryResultObject =
(JSONObject)new JSONParser().parse(deliveryResponse.getResponseMessage());
if(deliveryResponse.getResponseCode() == 200){
System.out.println("your SMS Status is " + deliveryResultObject.get("status"));
System.out.println("your SMS Message ID is " + deliveryResultObject.get("message_id"));
System.out.println("your SMS Sent Date is " + deliveryResultObject.get("date_sent"));
System.out.println("your SMS Delivered Date is "
+ deliveryResultObject.get("date_delivered"));
System.out.println("your request speed is " + deliveryResultObject.get("request_speed"));
} else {
System.out.println(deliveryResultObject.get("error"));
}


} catch (IsNullException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParseException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.iamraphson.jusibe.core.exceptions;
package com.unicodelabs.jusibe.core.exceptions;

/**
*
Expand Down
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.iamraphson.jusibe.core.utils;
package com.unicodelabs.jusibe.core.utils;

/**
*
Expand Down
Expand Up @@ -3,10 +3,11 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.iamraphson.jusibe.core;
package com.unicodelabs.jusibe.core;

import com.iamraphson.jusibe.core.exceptions.IsNullException;
import com.iamraphson.jusibe.core.utils.JusibeResponse;
import com.unicodelabs.jusibe.core.Jusibe;
import com.unicodelabs.jusibe.core.exceptions.IsNullException;
import com.unicodelabs.jusibe.core.utils.JusibeResponse;
import java.io.IOException;
import java.net.MalformedURLException;
import static org.junit.Assert.assertEquals;
Expand Down

0 comments on commit 8d9f56c

Please sign in to comment.