public
Description: A Ruby on Rails application that provides access to Unfuddle tickets without requiring a user account. Ideal for user access to helpdesk tickets. #crc
Clone URL: git://github.com/timriley/unfuddle-mirror.git
change ActiveResource models to use the /api/v1 URL and add an index 
action to tickets controller.
timriley (author)
Sat Sep 06 07:56:40 -0700 2008
commit  a4dd2743ed5648d713d005f9f93f459e16038eda
tree    68a74359311f17913b430046e3f7be2957cbb274
parent  9a99438979041eb53a8916e996853d870f680a58
...
1
 
 
 
 
 
 
 
 
2
3
4
...
1
2
3
4
5
6
7
8
9
10
11
12
0
@@ -1,4 +1,12 @@
0
 class TicketsController < ApplicationController
0
+ def index
0
+ @tickets = Ticket.find(:all)
0
+
0
+ respond_to do |format|
0
+ format.html
0
+ end
0
+ end
0
+
0
   def show
0
     @ticket = Ticket.find_by_number(params[:id])
0
     
...
1
2
3
4
 
 
5
6
...
1
2
 
 
3
4
5
6
0
@@ -1,5 +1,5 @@
0
 class Comment < ActiveResource::Base
0
 
0
- self.site = "https://#{APP_CONFIG['unfuddle_username']}:#{APP_CONFIG['unfuddle_password']}@#{APP_CONFIG['unfuddle_subdomain']}.unfuddle.com/projects/#{APP_CONFIG['unfuddle_project_id']}/tickets/:ticket_id/"
0
-
0
+ self.site = "https://#{APP_CONFIG['unfuddle_username']}:#{APP_CONFIG['unfuddle_password']}@#{APP_CONFIG['unfuddle_subdomain']}.unfuddle.com/api/v1/projects/#{APP_CONFIG['unfuddle_project_id']}/tickets/:ticket_id/"
0
+
0
 end
0
\ No newline at end of file
...
1
2
3
 
4
5
6
7
8
 
 
 
 
 
9
10
11
...
1
2
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
0
@@ -1,11 +1,16 @@
0
 class Ticket < ActiveResource::Base
0
   
0
- self.site = "https://#{APP_CONFIG['unfuddle_username']}:#{APP_CONFIG['unfuddle_password']}@#{APP_CONFIG['unfuddle_subdomain']}.unfuddle.com/projects/#{APP_CONFIG['unfuddle_project_id']}/"
0
+ self.site = "https://#{APP_CONFIG['unfuddle_username']}:#{APP_CONFIG['unfuddle_password']}@#{APP_CONFIG['unfuddle_subdomain']}.unfuddle.com/api/v1/projects/#{APP_CONFIG['unfuddle_project_id']}/"
0
   
0
   def self.find_by_number(number)
0
     find(:one, :from => "/projects/#{APP_CONFIG['unfuddle_project_id']}/tickets/by_number/#{number}.xml")
0
   end
0
   
0
+ # We use the ticket number (not the ID) in the URL, since the number is more meaningful.
0
+ def to_param
0
+ number
0
+ end
0
+
0
   def comments
0
     @comments ||= Comment.find(:all, :params => { :ticket_id => id })
0
   end

Comments

    No one has commented yet.