Module: TicketMaster::Provider::Basecamp

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

Overview

This is the Basecamp Provider for ticketmaster

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


7
8
9
# File 'lib/provider/basecamp.rb', line 7

def self.new(auth = {})
  TicketMaster.new(:basecamp, auth)
end

Instance Method Details

#authorize(auth = {}) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/provider/basecamp.rb', line 11

def authorize(auth = {})
  auth[:ssl] = true
  @authentication ||= TicketMaster::Authenticator.new(auth)
  auth = @authentication
  if (auth.domain.nil? and auth.subdomain.nil?) or (auth.token.nil? and (auth.username.nil? and auth.password.nil?))
    raise "Please provide at least an domain and token or username and password)"
  end
  unless auth.token.nil?
    auth.username = auth.token
    auth.password = 'Basecamp'
  end
  if auth.domain.nil? and auth.subdomain
    auth.domain = (auth.subdomain.include?('.') ? auth.subdomain : auth.subdomain + '.basecamphq.com')
  end
  BasecampAPI.establish_connection!(auth.domain, auth.username, auth.password, auth.ssl)
end

#valid?Boolean

Returns:

  • (Boolean)

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

def valid?
  begin
    !project_count = BasecampAPI::People.find(:me).nil?
  rescue
    false
  end
end