Module: TicketMaster::Provider::Teambox

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

Overview

This is the Teambox Provider for ticketmaster

Defined Under Namespace

Classes: Comment, Project, Ticket

Constant Summary collapse

TICKET_API =

The class to access the api’s tickets

TeamboxAPI::Task
PROJECT_API =

The class to access the api’s projects

TeamboxAPI::Project
API =

Ticket class for ticketmaster-teambox

TeamboxAPI::Task

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



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

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

def authorize(auth = {})
  @authentication ||= TicketMaster::Authenticator.new(auth)
  auth = @authentication
  if auth.username.blank? and auth.password.blank? and auth.client_id.nil? and auth.client_secret.nil?
    raise "Please provide username, password, client id and client secret"
  end
  TeamboxAPI.authenticate(auth.client_id, auth.client_secret, auth.username, auth.password)
end

#valid?Boolean

declare needed overloaded methods here

Returns:

  • (Boolean)


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

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