Module: TaskMapper::Provider::Bugherd

Includes:
Base
Defined in:
lib/provider/bugherd.rb,
lib/provider/project.rb,
lib/provider/comment.rb,
lib/provider/ticket.rb

Overview

This is the Bugherd Provider for taskmapper

Defined Under Namespace

Classes: Comment, Project, Ticket

Constant Summary collapse

TICKET_API =

The class to access the api’s tickets

Bugherd::Ticket
PROJECT_API =

The class to access the api’s projects

BugherdAPI::Project

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::Bugherd.new(auth)



9
10
11
# File 'lib/provider/bugherd.rb', line 9

def self.new(auth = {})
  TaskMapper.new(:bugherd, 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
# File 'lib/provider/bugherd.rb', line 15

def authorize(auth = {})
  @authentication ||= TaskMapper::Authenticator.new(auth)
  auth = @authentication
  if (auth.email.empty? || auth.password.empty?)
    raise "You must provide email and password for authentication"
  end
  BugherdAPI.authenticate(auth.email, auth.password)
  # Set authentication parameters for whatever you're using to access the API
end

#valid?Boolean

declare needed overloaded methods here

Returns:

  • (Boolean)


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

def valid?
  begin
    !BugherdAPI::User.find(:all).nil?
  rescue
    false
  end
end