Module: TicketMaster::Provider::Fogbugz

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

Overview

This is the Fogbugz Provider for ticketmaster

Defined Under Namespace

Classes: Comment, Project, Ticket

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api.



6
7
8
# File 'lib/provider/fogbugz.rb', line 6

def api
  @api
end

Class Method Details

.new(auth = {}) ⇒ Object

This is for cases when you want to instantiate using TicketMaster::Provider::Fogbugz.new(auth)



13
14
15
# File 'lib/provider/fogbugz.rb', line 13

def self.new(auth = {})
  TicketMaster.new(:fogbugz, 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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/provider/fogbugz.rb', line 19

def authorize(auth = {})
  @authentication ||= TicketMaster::Authenticator.new(auth)
  auth = @authentication

  unless auth.email? && auth.password? && auth.uri?
    raise TicketMaster::Exception.new 'Please provide email, password and uri'
  end

  begin
    @fogbugz = ::Fogbugz::Interface.new(:email => auth.email, 
      :uri => auth.uri, :password => auth.password)
    TicketMaster::Provider::Fogbugz.api = @fogbugz
    @fogbugz.authenticate
  rescue Exception => ex
    warn "There was a problem authenticaticating #{ex.message}"
  end
end

#project(*options) ⇒ Object



42
43
44
45
# File 'lib/provider/fogbugz.rb', line 42

def project(*options)
  id = options.empty? ? 0 : options.first.to_i
  Project.find_by_id(id)
end

#projects(*options) ⇒ Object

declare needed overloaded methods here



38
39
40
# File 'lib/provider/fogbugz.rb', line 38

def projects(*options)
  Project.find(options)
end

#valid?Boolean

Returns:

  • (Boolean)


47
48
49
50
51
52
53
54
# File 'lib/provider/fogbugz.rb', line 47

def valid?
  begin 
    @fogbugz.command(:search, :q => 'case')
    true
  rescue
    false
  end
end