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

Instance Method Summary collapse

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 authorize(auth = {})
  @authentication ||= TaskMapper::Authenticator.new(auth)
  auth = @authentication
  if (auth..nil? and auth.username.nil? and auth.password.nil?)
    raise "Please provide at least an url (subdomain), username and password)"
  end
  ZendeskAPI.authenticate(auth., auth.username, auth.password)
end

#project(*options) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/provider/zendesk.rb', line 27

def project(*options)
  unless options.empty?
    Project.new({:account => @authentication., :username => @authentication.username, :name => "#{@authentication.}-project"})
  else
    TaskMapper::Provider::Zendesk::Project
  end
end

#projects(*options) ⇒ Object



23
24
25
# File 'lib/provider/zendesk.rb', line 23

def projects(*options)
  [Project.new({:account => @authentication., :username => @authentication.username, :name => "#{@authentication.}-project"})]
end

#valid?Boolean

Returns:

  • (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