Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 36afa7e23ad9fa9933a73e38abcf4dbf9f36e8d4 @joshgrenon committed Jun 14, 2011
BIN .DS_Store
Binary file not shown.
@@ -0,0 +1,8 @@
+
+## Notifo API Libraries ##
+
+This is where a public collection of Notifo API code wrappers will be maintained.
+
+If you would like to add a language, please fork this repo, add your code (along with a README) and send a pull request. We'll push it right up!
+
+
@@ -0,0 +1,77 @@
+<!---
+ // **************************************** LICENSE INFO **************************************** \\
+
+ Copyright 2010, Bob Silverberg
+
+ 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.
+--->
+<cfcomponent hint="A wrapper for the Notifo API" output="false">
+
+ <cffunction name="init" access="public" returntype="Any" output="false">
+ <cfargument name="username" type="string" required="true" hint="The notifo username of the service" />
+ <cfargument name="apiSecret" type="string" required="true" hint="The notifo apiSecret of the service" />
+ <cfargument name="notifoUrl" type="string" required="false" default="https://api.notifo.com/v1/" hint="The base notifo url" />
+ <cfargument name="notifoTimeout" type="numeric" required="false" default="60" hint="The timeout for communication with the notifo service" />
+
+ <cfscript>
+ variables.username = arguments.username;
+ variables.apiSecret = arguments.apiSecret;
+ variables.notifoUrl = arguments.notifoUrl;
+ variables.notifoTimeout = arguments.notifoTimeout;
+ return this;
+ </cfscript>
+
+ </cffunction>
+
+ <cffunction name="send" access="public" returntype="struct" output="false" hint="Used to send a notification to a Notifo user">
+ <cfargument name="msg" type="string" required="true" hint="The message to send" />
+ <cfargument name="to" type="string" required="false" hint="The notifo user to send the message to" />
+ <cfargument name="label" type="string" required="false" hint="The label for the message" />
+ <cfargument name="title" type="string" required="false" hint="The title of the message" />
+ <cfargument name="uri" type="string" required="false" hint="The uri to open after viewing the message" />
+
+ <cfreturn sendRequest(urlSuffix="send_notification",params=arguments) />
+
+ </cffunction>
+
+ <cffunction name="subscribe" access="public" returntype="struct" output="false" hint="Used to send a notification to a Notifo user">
+ <cfargument name="username" type="string" required="true" hint="The notifo user who wishes to subscribe" />
+
+ <cfreturn sendRequest(urlSuffix="subscribe_user",params=arguments) />
+
+ </cffunction>
+
+ <cffunction name="sendRequest" access="public" returntype="struct" output="false" hint="Used to send a notification to a Notifo user">
+ <cfargument name="urlSuffix" type="string" required="true" hint="The API suffix for the service" />
+ <cfargument name="params" type="struct" required="true" hint="Parameters to be added to the http call" />
+
+ <cfset var returnStruct = {success=false,httpResponse=structNew(),notifoResponse=structNew()} />
+ <cfset var param = 0 />
+ <cfhttp url="#variables.notifoUrl##arguments.urlSuffix#" username="#variables.username#" password="#variables.apiSecret#" method="post" redirect="false" timeout="#variables.notifoTimeout#">
+ <cfloop collection="#arguments.params#" item="param">
+ <cfif isDefined("arguments.params.#param#")>
+ <cfhttpparam name="#lCase(param)#" value="#arguments.params[param]#" encoded="true" type="formfield" />
+ </cfif>
+ </cfloop>
+ </cfhttp>
+ <cfset returnStruct.httpResponse = cfhttp />
+ <cfif structKeyExists(cfhttp,"Responseheader") and cfhttp.Responseheader.Status_Code eq 200>
+ <cfset returnStruct.success = true />
+ </cfif>
+ <cfif structKeyExists(cfhttp,"Filecontent") and isJson(cfhttp.Filecontent)>
+ <cfset returnStruct.notifoResponse = deserializeJSON(cfhttp.Filecontent) />
+ </cfif>
+ <cfreturn returnStruct />
+
+ </cffunction>
+
+</cfcomponent>
+
@@ -0,0 +1,45 @@
+## CFNotifo - A CFML (ColdFusion) Wrapper for the Notifo API ##
+
+### What is Notifo? ###
+
+Notifo is a service which allows you to send push notifications to mobile clients from a server via a REST interface.
+
+### What is CFNotifo? ###
+
+CFNotifo is an API wrapper for the Notifo service which makes subscribing users and sending notifications easy peasy.
+
+### Requirements ###
+
+1. [ColdFusion 8+](http://www.coldfusion.com), [Railo](http://www.getrailo.org/) or [OpenBD](http://www.openbluedragon.org/)
+2. A [Notifo](http://notifo.com) service account, for sending notifications
+
+### Usage ###
+
+Create an instance of CFNotifo, passing in the credentials for the service:
+ CFNotifo = createObject("component","CFNotifo").init(username="serviceNotifoUsername",apiSecret="serviceAPISecret");
+
+Subscribe a user to your service:
+ response = CFNotifo.subscribe(username="userToSubscribe");
+ if (response.success)
+ {
+ // It worked!
+ } else
+ {
+ // Something went wrong
+ writeDump(var=response.notifoResponse, label="Notifo's Response");
+ }
+
+Send a notification to a user:
+ response = CFNotifo.send(to="subscribedUser", msg="Message to send");
+ if (response.success)
+ {
+ // It worked!
+ } else
+ {
+ // Something went wrong
+ writeDump(var=response.notifoResponse, label="Notifo's Response");
+ }
+
+### Demo ###
+
+An online demo of CFNotifo is available on [my blog](http://www.silverwareconsulting.com/CFNotifo.cfm)
@@ -0,0 +1,14 @@
+
+## .NET Notifo Library ##
+
+### C# / RestSharp ###
+
+Here is a link to @johnsheehan's "FoSharp" library on github:
+
+[http://github.com/johnsheehan/FoSharp] (http://github.com/johnsheehan/FoSharp)
+
+### C# / Exyll.Notifo ###
+
+This is implemented by Ramon Smits (@ramonsmits) and has no dependancies accept .net framework v4.0 client profile.
+
+[http://github.com/ramonsmits/Exyll.Notifo] (http://github.com/ramonsmits/Exyll.Notifo)
@@ -0,0 +1 @@
+Lasso wrapper for the Notifo API.
Oops, something went wrong.

0 comments on commit 36afa7e

Please sign in to comment.