Sha256: d2fe6f08c044ceed4d9d11577eb005116ca9694e0e7a380625db571fc85f0f00

Contents?: true

Size: 899 Bytes

Versions: 3

Compression:

Stored size: 899 Bytes

Contents

module TicketMaster::Provider
  # This is the Pivotal Tracker Provider for ticketmaster
  module Pivotal
    include TicketMaster::Provider::Base
    TICKET_API = PivotalAPI::Story
    PROJECT_API = PivotalAPI::Project
    
    # This is for cases when you want to instantiate using TicketMaster::Provider::Lighthouse.new(auth)
    def self.new(auth = {})
      TicketMaster.new(:pivotal, auth)
    end
    
    # The authorize and initializer for this provider
    def authorize(auth = {})
      @authentication ||= TicketMaster::Authenticator.new(auth)
      auth = @authentication
      if auth.token
        PivotalAPI.token = auth.token
      elsif auth.username && auth.password
        PivotalAPI.authenticate(auth.username, auth.password)
      end
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ticketmaster-pivotal-0.5.1 lib/provider/pivotal.rb
ticketmaster-pivotal-0.5.0 lib/provider/pivotal.rb
ticketmaster-pivotal-0.4.9 lib/provider/pivotal.rb