Module: TicketMaster::Provider::Bugshelf

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

Overview

This is the Bugshelf Provider for ticketmaster

Defined Under Namespace

Classes: Comment, Project, Ticket

Constant Summary collapse

TICKET_API =

The class to access the api’s tickets

Bugshelf::Ticket
PROJECT_API =

The class to access the api’s projects

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



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

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

Instance Method Details

#authorize(auth = {}) ⇒ Object

Authorize with subdomain and api_key, eg.: Bugshelf::authorize(:subdomain => ‘subforcompany’, :api_key => ‘szgduztad7asdtuzagdgkasdgf)



14
15
16
17
18
19
20
21
22
# File 'lib/provider/bugshelf.rb', line 14

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

  if auth.subdomain.blank? or auth.api_key.blank?
    raise "Please provide at least a set of subdomain and api_key)"
  end
  ::BugshelfAPI.authenticate(auth.subdomain, auth.api_key)
end

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
# File 'lib/provider/bugshelf.rb', line 24

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