Module: TaskMapper::Provider::Unfuddle
- Includes:
- Base
- Defined in:
- lib/provider/unfuddle.rb,
lib/provider/project.rb,
lib/provider/comment.rb,
lib/provider/ticket.rb
Overview
This is the Unfuddle Provider for taskmapper
Defined Under Namespace
Classes: Comment, Project, Ticket
Constant Summary collapse
- TICKET_API =
The class to access the api’s tickets
UnfuddleAPI::Ticket
- PROJECT_API =
The class to access the api’s projects
UnfuddleAPI::Project
Class Method Summary collapse
-
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TaskMapper::Provider::Unfuddle.new(auth).
Instance Method Summary collapse
-
#authorize(auth = {}) ⇒ Object
Providers must define an authorize method.
-
#valid? ⇒ Boolean
declare needed overloaded methods here.
Class Method Details
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TaskMapper::Provider::Unfuddle.new(auth)
9 10 11 |
# File 'lib/provider/unfuddle.rb', line 9 def self.new(auth = {}) TaskMapper.new(:unfuddle, auth) end |
Instance Method Details
#authorize(auth = {}) ⇒ Object
Providers must define an authorize method. This is used to initialize and set authentication parameters to access the API
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/provider/unfuddle.rb', line 15 def (auth = {}) @authentication ||= TaskMapper::Authenticator.new(auth) auth = @authentication if (auth.account.nil? and auth.subdomain.nil?) or auth.username.nil? or auth.password.nil? raise "Please provide at least an account (subdomain), username and password)" end UnfuddleAPI.protocol = auth.protocol if auth.protocol? UnfuddleAPI.account = auth.account || auth.subdomain UnfuddleAPI.authenticate(auth.username, auth.password) end |
#valid? ⇒ Boolean
declare needed overloaded methods here
28 29 30 31 32 33 34 35 |
# File 'lib/provider/unfuddle.rb', line 28 def valid? begin PROJECT_API.find(:first) true rescue false end end |