Module: TicketMaster::Provider::Base

Includes:
Helper
Included in:
Dummy, Tester, Yoursystem
Defined in:
lib/ticketmaster/ticket.rb,
lib/ticketmaster/comment.rb,
lib/ticketmaster/project.rb,
lib/ticketmaster/provider.rb

Defined Under Namespace

Classes: Comment, Project, Ticket

Constant Summary collapse

PROJECT_API =

The Class for the project api interaction

nil
TICKET_API =

The Class for the ticket api interaction

nil

Instance Method Summary collapse

Methods included from Helper

#easy_finder, #filter_string, #provider_parent, #search_by_attribute, #search_filter, #this_method

Instance Method Details

#authorize(authentication = {}) ⇒ Object

All providers must define this method. It doesn't have to do anything, it just has to be there. But since it's here, you don't have to worry about it as long as you “include TicketMaster::Provider::Base”

If you need to do some additional things to initialize the instance, here is where you would put it


24
25
26
# File 'lib/ticketmaster/provider.rb', line 24

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

#project(*options) ⇒ Object

Providers should try to define this method

It returns the project class for this provider, so that there can be calls such as

ticketmaster.project.find :all
ticketmaster.project(:id => 777, :name => 'Proj test')

Should try to implement a find :first (or find with singular result) if given parameters


41
42
43
# File 'lib/ticketmaster/provider.rb', line 41

def project(*options)
  easy_finder(@provider::Project, :first, options)
end

#project!(*options) ⇒ Object

Create a project same as project.create()


54
55
56
# File 'lib/ticketmaster/provider.rb', line 54

def project!(*options)
  project.create(*options)
end

#projects(*options) ⇒ Object

All providers should try to define this method.

It returns all projects in an array Should try to implement a find :all if given parameters


49
50
51
# File 'lib/ticketmaster/provider.rb', line 49

def projects(*options)
  easy_finder(@provider::Project, :all, options)
end

#ticket(*options) ⇒ Object

Providers should try to define this method

It returns the ticket class for this provider, so that there can be calls such as

ticketmaster.ticket.find :all
ticketmaster.ticket(:id => 102, :title => 'Ticket')

Don't confuse this with project.ticket.find(…) since that deals with tickets specific to a project. This is deals with tickets

Should try to implement a find :first (or find with singular result) if given parameters


68
69
70
# File 'lib/ticketmaster/provider.rb', line 68

def ticket(*options)
  easy_finder(@provider::Ticket, :first, options)
end

#tickets(*options) ⇒ Object

All providers should try to define this method

It returns all tickets in an array. Should try to implement a find :all if given parameters


76
77
78
# File 'lib/ticketmaster/provider.rb', line 76

def tickets(*options)
  easy_finder(@provider::Ticket, :all, options)
end

#valid?Boolean

All providers must define this method. It should implement the code for validating the authentication

Returns:

  • (Boolean)

Raises:


30
31
32
# File 'lib/ticketmaster/provider.rb', line 30

def valid?
  raise TicketMaster::Exception.new("#{Base.name}::#{this_method} method must be implemented by the provider")
end