Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update dependencies

Now using sbt 0.11.2 and Dispatch 0.8.8
  • Loading branch information...
commit 271598d6e16d14b8838ecfd1168045025f78e36c 1 parent 4a30b84
Peter Robinett authored April 25, 2012
2  README.md
Source Rendered
@@ -16,7 +16,7 @@ BFUrbanAirship is a Scala library for the [Urban Airship](http://www.urbanairshi
16 16
 
17 17
 ## Getting the library
18 18
 
19  
-Currently you'll need to checkout the source code and build it using [sbt](https://github.com/harrah/xsbt/wiki) **0.7.4**. `sbt publish-local` should do the trick.
  19
+Currently you'll need to checkout the source code and build it using [sbt](https://github.com/harrah/xsbt/wiki) **0.11.2**. `sbt publish-local` should do the trick.
20 20
 
21 21
 ## TODO
22 22
 
13  build.sbt
... ...
@@ -0,0 +1,13 @@
  1
+name := "BFUrbanAirship"
  2
+
  3
+version := "0.2-SNAPSHOT"
  4
+
  5
+organization := "com.bubblefoundry"
  6
+
  7
+scalaVersion := "2.9.1"
  8
+
  9
+libraryDependencies += "net.databinder" %% "dispatch-gae" % "0.8.8"
  10
+
  11
+libraryDependencies += "net.liftweb" %% "lift-json" % "2.4"
  12
+
  13
+libraryDependencies += "net.liftweb" %% "lift-util" % "2.4"
9  project/build.properties
... ...
@@ -1,8 +1 @@
1  
-#Project properties
2  
-#Sat Jan 15 10:23:57 CET 2011
3  
-project.organization=com.bubblefoundry
4  
-project.name=bfurbanairship
5  
-sbt.version=0.7.4
6  
-project.version=0.1
7  
-build.scala.versions=2.8.1
8  
-project.initialize=false
  1
+sbt.version=0.11.2
20  project/build/bfurbanairship.scala
... ...
@@ -1,20 +0,0 @@
1  
-import sbt._
2  
-
3  
-class BFUrbanAirshipProject(info: ProjectInfo) extends DefaultProject(info)
4  
-{
5  
-  // val dispatch_json = "net.databinder" %% "dispatch-json" % "0.7.8"
6  
-  // val dispatch_lift_json = "net.databinder" %% "dispatch-lift-json" % "0.7.8"
7  
-  val scalatoolsSnapshot = "Scala Tools Snapshot" at "http://scala-tools.org/repo-snapshots/"
8  
-  val liftVersion = "2.3-M1"
9  
-  
10  
-  val dispatch_vers = "0.8.0.Beta3"
11  
-  // lazy val dispatch_meetup = "net.databinder" %% "dispatch-meetup" % dispatch_vers
12  
-  lazy val dispatch_gae = "net.databinder" %% "dispatch-http-gae" % dispatch_vers
13  
-  lazy val dispatch_liftjson = "net.databinder" %% "dispatch-lift-json" % dispatch_vers
14  
-
15  
-  val appengineRepo = "nexus" at "http://maven-gae-plugin.googlecode.com/svn/repository/"
16  
-  
17  
-  // val dispatch = "net.databinder" %% "dispatch" % "0.7.8"
18  
-  val lift_common = "net.liftweb" %% "lift-common" % liftVersion
19  
-  val lift_util = "net.liftweb" %% "lift-util" % liftVersion
20  
-}
39  src/main/scala/com/bubblefoundry/bfurbanairship/UrbanAirship.scala
... ...
@@ -1,7 +1,6 @@
1 1
 package com.bubblefoundry.bfurbanairship
2 2
 
3 3
 import dispatch._
4  
-import dispatch.liftjson.Js._
5 4
 import net.liftweb.json.parse
6 5
 import net.liftweb.json.JsonAST._
7 6
 import net.liftweb.json.Serialization.write
@@ -108,17 +107,17 @@ class UrbanAirship(app_token: String, app_secret: Box[String], app_master_secret
108 107
 
109 108
   def register_device(device: Device): Box[Device] = app_secret.flatMap(secret => {
110 109
     val req = devicesReq / device.device_token <<< write(device) <:< Map("Content-Type" -> "application/json") as (app_token, secret)
111  
-    Helpers.tryo(http(req ># (json => {
112  
-      json.extract[Device] // then update the returned object with its tags, since it apparently doesn't return them?
113  
-    })))
  110
+    Helpers.tryo(http(req >- (jsonStr => 
  111
+      parse(jsonStr).extract[Device] // then update the returned object with its tags, since it apparently doesn't return them?
  112
+    )))
114 113
   }) ?~ "App Secret required"
115 114
   
116 115
   // GET device 
117 116
   def device(device_token: String): Box[Device] = app_master_secret.flatMap(secret => {
118 117
     val req = devicesReq / device_token as (app_token, secret)
119  
-    Helpers.tryo(http(req ># (json => {
120  
-      json.extract[Device]
121  
-    })))    
  118
+    Helpers.tryo(http(req >- (jsonStr => 
  119
+      parse(jsonStr).extract[Device]
  120
+    )))    
122 121
   }) ?~ "App Master Secret Required"
123 122
   def device(d: Device): Box[Device] = device(d.device_token)
124 123
   
@@ -126,9 +125,9 @@ class UrbanAirship(app_token: String, app_secret: Box[String], app_master_secret
126 125
   def devices: Box[Stream[Device]] = app_master_secret.flatMap(secret => {
127 126
     def getPage(page: Int) = {
128 127
       val req = devicesReq / "" <<? Map("page" -> page.toString) as (app_token, secret)
129  
-      Helpers.tryo(http(req ># (json => {
130  
-        json.extract[DevicesPage]
131  
-      })))
  128
+      Helpers.tryo(http(req >- (jsonStr => 
  129
+        parse(jsonStr).extract[DevicesPage]
  130
+      )))
132 131
     }
133 132
     
134 133
     // get the first page
@@ -150,20 +149,24 @@ class UrbanAirship(app_token: String, app_secret: Box[String], app_master_secret
150 149
   // feedback service
151 150
   def feedback(since: String): Box[List[Device]] =  app_master_secret.flatMap(secret => {
152 151
     val req = feedbackReq / "" <<? Map("since" -> since) as (app_token, secret) 
153  
-    Helpers.tryo(http(req ># (json => {
154  
-      json.children.map(_.extract[Device])
155  
-    })))
  152
+    Helpers.tryo(http(req >- (jsonStr => 
  153
+      parse(jsonStr).children.map(_.extract[Device])
  154
+    )))
156 155
   }) ?~ "App Master Secret Required"
157 156
   
158 157
   
159 158
   def devices_count: Box[DevicesCount] = app_master_secret.flatMap(secret => {
160 159
     val req = devicesReq / "count" / "" as (app_token, secret)
161  
-    Helpers.tryo(http(req ># (_.extract[DevicesCount])))
  160
+    Helpers.tryo(http(req >- (jsonStr => 
  161
+      parse(jsonStr).extract[DevicesCount]
  162
+    )))
162 163
   }) ?~ "App Master Secret Required"
163 164
   
164 165
   def push[M <: PushMessage[_]](message: M): Box[ScheduledPushes] = app_master_secret.flatMap(secret => {
165 166
     val req = pushReq / "" << (write(message), "application/json") as (app_token, secret)
166  
-    Helpers.tryo(http(req ># (json => json.extract[ScheduledPushes])))
  167
+    Helpers.tryo(http(req >- (jsonStr =>
  168
+      parse(jsonStr).extract[ScheduledPushes]
  169
+    )))
167 170
   }) ?~ "App Master Secret Required"
168 171
   
169 172
   /*
@@ -258,9 +261,9 @@ class UrbanAirship(app_token: String, app_secret: Box[String], app_master_secret
258 261
   
259 262
   def statistics(start: String, end: String): Box[List[HourlyStatistics]] = app_master_secret.flatMap(secret => {
260 263
     val req = statisticsReq <<? Map("start" -> start, "end" -> end) as (app_token, secret) 
261  
-    Helpers.tryo(http(req ># (json => {
262  
-      json.children.map(_.extract[HourlyStatistics])
263  
-    })))
  264
+    Helpers.tryo(http(req >- (jsonStr => 
  265
+      parse(jsonStr).children.map(_.extract[HourlyStatistics])
  266
+    )))
264 267
   }) ?~ "App Master Secret required"
265 268
   
266 269
   /* TAGS */

0 notes on commit 271598d

Please sign in to comment.
Something went wrong with that request. Please try again.