Module: TaskMapper::Provider::Pivotal

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

Overview

This is the Pivotal Tracker Provider for taskmapper

Defined Under Namespace

Classes: Comment, Project, Ticket

Constant Summary collapse

TICKET_API =
PivotalAPI::Story
PROJECT_API =
PivotalAPI::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::Lighthouse.new(auth)



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

def self.new(auth = {})
  TaskMapper.new(:pivotal, auth)
end

Instance Method Details

#authorize(auth = {}) ⇒ Object

The authorize and initializer for this provider



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/provider/pivotal.rb', line 14

def authorize(auth = {})
  @authentication ||= TaskMapper::Authenticator.new(auth)
  auth = @authentication
  if auth.token.empty?
    raise "You should pass a token for authentication"
  end
  if auth.token
    PivotalAPI.token = auth.token
  elsif auth.username && auth.password
    PivotalAPI.authenticate(auth.username, auth.password)
  end
end

#valid?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/provider/pivotal.rb', line 27

def valid?
  !PROJECT_API.find(:first).nil?
rescue ActiveResource::UnauthorizedAccess
  false
end