Index: unfuddle_api.classes.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/unfuddle_api/unfuddle_api.classes.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 unfuddle_api.classes.inc
--- unfuddle_api.classes.inc	8 Nov 2009 20:42:33 -0000	1.2.2.1
+++ unfuddle_api.classes.inc	16 Nov 2009 22:46:13 -0000
@@ -9,34 +9,34 @@
  * Primary Unfuddle API implementation class.
  */
 class Unfuddle {
-  
+
   protected $url;
   protected $user;
   protected $pass;
   protected $project;
-  
+
   protected $format = 'json';
-  
+
   public function __construct($url = NULL, $user = NULL, $pass = NULL, $project = NULL) {
     $this->url = is_null($url) ? variable_get('unfuddle_api_url', '') : $url;
     $this->user = is_null($user) ? variable_get('unfuddle_api_user', '') : $user;
     $this->pass = is_null($pass) ? variable_get('unfuddle_api_pass', '') : $pass;
     $this->project = is_null($project) ? variable_get('unfuddle_api_project', '') : $project;
   }
-  
+
   public function setURL($url) {
     $this->url = $url;
   }
-  
+
   public function setAuth($user, $pass) {
     $this->user = $user;
     $this->pass = $pass;
   }
-  
+
   public function setProject($projectID) {
     $this->project = $projectID;
   }
-  
+
   // Projects.
   public function getProjects() {
     try {
@@ -49,7 +49,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getProject($projectID = NULL) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -62,7 +62,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   // People.
   public function getPeople($projectID = NULL) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
@@ -76,7 +76,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getProjectPeople($projectID = NULL) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -89,7 +89,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getPerson($personID) {
     try {
       $person = $this->request($this->url . '/api/v1/people/' . $personID);
@@ -101,7 +101,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   // Messages.
   public function getMessages($projectID = NULL) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
@@ -115,7 +115,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getMessage($projectID = NULL, $messageID) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -128,7 +128,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function createMessage($projectID = NULL, $title, $body) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     $message =
@@ -136,7 +136,7 @@ class Unfuddle {
     "  <body>" . $body . "</body>\n".
     "  <title>" . $title . "</title>\n".
     "  </message>\n";
-    
+
     // POST message.
     try {
       $response = $this->request($this->url . '/api/v1/projects/' . $projectID . '/messages', $message, 'POST');
@@ -150,7 +150,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getCategories($projectID = NULL) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -163,7 +163,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getCategory($projectID = NULL, $categoryID) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -176,7 +176,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   // Tickets.
   public function getTickets($projectID = NULL) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
@@ -190,7 +190,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getTicket($projectID = NULL, $ticketID) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -203,7 +203,7 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function getTicketByNumber($projectID = NULL, $ticketNum) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     try {
@@ -216,19 +216,19 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
+
   public function createTicket($projectID = NULL, $summary, $description, $fields = array()) {
     $projectID = is_null($projectID) ? $this->project : $projectID;
     $message =
     "<ticket>\n".
     "  <summary>" . $summary . "</summary>\n".
     "  <description><![CDATA[" . $description . "]]></description>\n".
-    "  <priority>" . isset($fields['priority']) ? $fields['priority'] : 5  . "</priority>\n".
+    "  <priority>" . (isset($fields['priority']) ? $fields['priority'] : 3) . "</priority>\n".
     "  <project-id>" . $projectID . "</project-id>\n".
     "  <status>new</status>\n".
     "  </ticket>\n";
     // @TODO handle other fields, maybe create a SimpleXML object?
-    
+
     // POST message.
     try {
       $response = $this->request($this->url . '/api/v1/projects/' . $projectID . '/tickets', $message, 'POST');
@@ -242,9 +242,9 @@ class Unfuddle {
       return FALSE;
     }
   }
-  
-  
-  
+
+
+
   /**
    * Build and perform the request.
    */
@@ -271,7 +271,7 @@ class Unfuddle {
         $headers['Accept'] = 'application/xml';
         break;
     }
-    
+
     $response = drupal_http_request($url, $headers, $method, $data);
     switch ($response->code) {
       case '200':
@@ -286,7 +286,7 @@ class Unfuddle {
         throw new Exception($response->error);
     }
   }
-  
+
   protected function parseResponse($response) {
     switch ($this->format) {
       case 'json':
@@ -295,4 +295,4 @@ class Unfuddle {
         return @simplexml_load_string($response);
     }
   }
-}
\ No newline at end of file
+}
