Module: TaskMapper::Provider::Zendesk
- Includes:
- Base
- Defined in:
- lib/provider/zendesk.rb,
lib/provider/project.rb,
lib/provider/comment.rb,
lib/provider/ticket.rb
Overview
This is the Zendesk Provider for taskmapper
Defined Under Namespace
Classes: Comment, Project, Ticket
Class Method Summary collapse
-
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TaskMapper::Provider::Yoursystem.new(auth).
Instance Method Summary collapse
-
#authorize(auth = {}) ⇒ Object
The authorize and initializer for this provider.
- #project(*options) ⇒ Object
- #projects(*options) ⇒ Object
- #valid? ⇒ Boolean
Class Method Details
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TaskMapper::Provider::Yoursystem.new(auth)
9 10 11 |
# File 'lib/provider/zendesk.rb', line 9 def self.new(auth = {}) TaskMapper.new(:zendesk, auth) end |
Instance Method Details
#authorize(auth = {}) ⇒ Object
The authorize and initializer for this provider
14 15 16 17 18 19 20 21 |
# File 'lib/provider/zendesk.rb', line 14 def (auth = {}) @authentication ||= TaskMapper::Authenticator.new(auth) auth = @authentication if (auth.account.nil? and auth.username.nil? and auth.password.nil?) raise "Please provide at least an url (subdomain), username and password)" end ZendeskAPI.authenticate(auth.account, auth.username, auth.password) end |
#project(*options) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/provider/zendesk.rb', line 27 def project(*) unless .empty? Project.new({:account => @authentication.account, :username => @authentication.username, :name => "#{@authentication.account}-project"}) else TaskMapper::Provider::Zendesk::Project end end |
#projects(*options) ⇒ Object
23 24 25 |
# File 'lib/provider/zendesk.rb', line 23 def projects(*) [Project.new({:account => @authentication.account, :username => @authentication.username, :name => "#{@authentication.account}-project"})] end |
#valid? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/provider/zendesk.rb', line 35 def valid? begin !ZendeskAPI::Search.find(:first, :params => {:query => "status:open"}).nil? rescue false end end |