Skip to content

Commit

Permalink
Added Marshaller and Unmarshaller to Client definition, and added R t…
Browse files Browse the repository at this point in the history
…ype to the Payload
  • Loading branch information
alexanderdean committed Apr 13, 2012
1 parent b1ef09a commit 96ba0c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/co/orderly/narcolepsy/Client.scala
Expand Up @@ -15,6 +15,7 @@ package co.orderly.narcolepsy
// Orderly
import utils._
import adapters._
import marshallers.{Marshaller, Unmarshaller}

/**
* Client is an abstract Narcolepsy class you can use to build a web services client
Expand Down Expand Up @@ -56,10 +57,10 @@ abstract class Client(
protected val resources: Api

// The marshaller
// protected val marshaller:
protected val marshaller: Marshaller

// The unmarshaller
// TODO
protected val unmarshaller: Unmarshaller

// -------------------------------------------------------------------------------------------------------------------
// You can override the following defaults in your NarcolepsyClient if you want
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/co/orderly/narcolepsy/Query.scala
Expand Up @@ -149,7 +149,7 @@ abstract class Query[
* request. Typically used by PUT and POST requests.
*/
// TODO: need to update this so that payload can be typed
trait Payload {
trait Payload[R <: Representation] {

// Grab _payload from Query
self: {
Expand Down Expand Up @@ -254,15 +254,15 @@ class DeleteQuery(client: Client, resource: String)
class PutQuery[R <: Representation](client: Client, resource: String, typeR: Class[R])
extends Query[R](PutMethod, client, resource, typeR)
with Id
with Payload
with Payload[R]

/**
* PostQuery is for performing a POST on a resource. This is typically used for creating
* an all-new resource
*/
class PostQuery[R <: Representation](client: Client, resource: String, typeR: Class[R])
extends Query[R](PostMethod, client, resource, typeR)
with Payload
with Payload[R]

// TODO: add HeadQuery

Expand Down

0 comments on commit 96ba0c0

Please sign in to comment.