Module: TaskMapper::Provider::Trac
- Includes:
- Base
- Defined in:
- lib/provider/trac.rb,
lib/provider/project.rb,
lib/provider/comment.rb,
lib/provider/ticket.rb
Overview
This is the Yoursystem Provider for taskmapper
Defined Under Namespace
Classes: Comment, Project, Ticket
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.api ⇒ Object
35
36
37
|
# File 'lib/provider/trac.rb', line 35
def self.api
@api
end
|
.api=(trac_instance) ⇒ Object
31
32
33
|
# File 'lib/provider/trac.rb', line 31
def self.api=(trac_instance)
@api = trac_instance
end
|
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TaskMapper::Provider::Yoursystem.new(auth)
7
8
9
|
# File 'lib/provider/trac.rb', line 7
def self.new(auth = {})
TaskMapper.new(:trac, auth)
end
|
Instance Method Details
#authorize(auth = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/provider/trac.rb', line 11
def authorize(auth = {})
@authentication ||= TaskMapper::Authenticator.new(auth)
auth = @authentication
@trac = ::Trac.new(auth.url, auth.username, auth.password)
TaskMapper::Provider::Trac.api = {:trac => @trac, :url => auth.url, :username => auth.username, :password => auth.password}
end
|
#project(*options) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/provider/trac.rb', line 23
def project(*options)
unless options.empty?
Project.new({:url => @authentication.url, :username => @authentication.username, :name => "#{@authentication.username}-project"})
else
TaskMapper::Provider::Trac::Project
end
end
|
#projects(*options) ⇒ Object
declare needed overloaded methods here
19
20
21
|
# File 'lib/provider/trac.rb', line 19
def projects(*options)
[Project.new({:url => @authentication.url, :username => @authentication.username, :name => "#{@authentication.username}-project"})]
end
|
#valid? ⇒ Boolean
39
40
41
42
43
44
45
46
|
# File 'lib/provider/trac.rb', line 39
def valid?
begin
@trac.tickets.list
true
rescue Exception
false
end
end
|