Module: TicketMaster::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 ticketmaster

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 TicketMaster::Provider::Lighthouse.new(auth)



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

def self.new(auth = {})
  TicketMaster.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 ||= TicketMaster::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
32
33
34
# File 'lib/provider/pivotal.rb', line 27

def valid?
  begin
    PROJECT_API.find(:first)
    true
  rescue
    false
  end
end