Skip to content

Commit

Permalink
Changed build repo and modified READMe.md
Browse files Browse the repository at this point in the history
  • Loading branch information
osaetinevbuoma committed Aug 20, 2016
1 parent 0fa4a75 commit 6d6b617
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
49 changes: 37 additions & 12 deletions README.md
Expand Up @@ -9,7 +9,6 @@ Grails plugin for Infobip SMS API
### Generate basic authorization ###

```
String basicAuthorization(String username, String password)
```
* username - infobip username
Expand All @@ -20,7 +19,6 @@ String basicAuthorization(String username, String password)
### Send an SMS to a single phone number ###

```
JSONObject sendSingleMessage(String authorization, String from, String to, String text)
```
* from - Sender phone number registered on infobip (Phone numbers are usually prefixed with *+ (plus sign)*, followed by a *country code*, *network code* and the *subscriber number*)
Expand All @@ -30,21 +28,18 @@ JSONObject sendSingleMessage(String authorization, String from, String to, Strin
### Send an SMS to multiple phone numbers ###

```
JSONObject sendSingleMessage(String authorization, String from, List to, String text)
```
* to - A list of string types of recipients' phone numbers

### Send multiple SMS's to multiple or same recipient phone number ###

```
JSONObject sendMultipleMessages(String authorization, JSONObject data)
```
* data - A json object of data. An example is show below.

```
{
"messages":[
{
Expand All @@ -67,14 +62,12 @@ JSONObject sendMultipleMessages(String authorization, JSONObject data)
### Get delivery reports ###

```
JSONObject deliveryReport(String authorization)
```

### Get filtered delivery reports ###

```
JSONObject deliveryReport(String authorization, Map filters)
```
* filters - A filter map. View [here](https://dev.infobip.com/docs/delivery-reports) for more filter information.
Expand All @@ -84,22 +77,34 @@ JSONObject deliveryReport(String authorization, Map filters)
### Get logs ###

```
JSONObject messageLog(String authorization)
```

### Get filtered logs ###

```
JSONObject messageLog(String authorization, Map filters)
```
* filters - A filter map. View [here](https://dev.infobip.com/docs/message-logs) for filter information.

## Installation ##
Edit application.groovy (or application.yml if you prefer) and build.gradle

* application.groovy
```
infobip.host = "https://api.infobip.com"
```

**OR**

* application.yml
```
infobip:
host: https://api.infobip.com
```

* build.gradle
```
repositories {
maven {
url "http://dl.bintray.com/modnsolutions/grails-plugins"
Expand All @@ -115,23 +120,43 @@ dependencies {
* Import the required service classes into you Grails Service or Controller class.

```
import com.modnsolutions.AuthorizationService
import com.modnsolutions.SendMessageService
```
* Inject AuthorizationService and SendMessageService classes into your Grails Service or Controller class.

```
AuthorizationService authorizationService
SendMessageService sendMessageService
```

* In your class method, generate your basic authorization code and send your messages

```
String basicAuthorization = authorizationService.basicAuthorization("INFOBIP_USERNAME", "INFOBIP_PASSWORD")
JSONObject singleMessageResponse = sendMessageService.sendSingleMessage(basicAuthorization, from, to, text)
println singleMessageResponse
```

### Example ###
```
import com.modnsolutions.AuthorizationService
import com.modnsolutions.SendMessageService
import org.grails.web.json.JSONArray
class SMSController {
AuthorizationService authorizationService
SendMessageService sendMessageService
def sendSingleSMS(String from, String to, String text) {
String basicAuthorization = authorizationService.basicAuthorization("INFOBIP_USERNAME", "INFORBIP_PASSWORD")
JSONObject singleMessageResponse = sendMessageService.sendSingleMessage(basicAuthorization, from, to, text)
println singleMessageResponse
flash.message = singleMessageResponse
render view: "/index.gsp"
}
...
}
```
7 changes: 4 additions & 3 deletions build.gradle
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
}

version "0.1"
version "1.0"
group "com.modnsolutions"

apply plugin:"eclipse"
Expand All @@ -30,6 +30,7 @@ ext {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://dl.bintray.com/modnsolutions/plugins-libraries" }
}

dependencyManagement {
Expand All @@ -49,7 +50,7 @@ dependencies {
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "com.modnsolutions:RESTHttpService:0.1"
compile "com.modnsolutions:RESTHttpService:1.0"
console "org.grails:grails-console"
profile "org.grails.profiles:web-plugin"
provided "org.grails:grails-plugin-services"
Expand All @@ -66,7 +67,7 @@ grailsPublish {
githubSlug = "osaetinevbuoma/modninfobip"
vcsUrl = "https://github.com/osaetinevbuoma/modninfobip"
userOrg = "modnsolutions"
repo = "grails-plugins"
repo = "plugins-libraries"
license {
name = 'Apache-2.0'
}
Expand Down

0 comments on commit 6d6b617

Please sign in to comment.