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
-
#authorize(authentication = {}) ⇒ Object
All providers must define this method.
-
#project(*options) ⇒ Object
Providers should try to define this method.
-
#project!(*options) ⇒ Object
Create a project same as project.create().
-
#projects(*options) ⇒ Object
All providers should try to define this method.
-
#ticket(*options) ⇒ Object
Providers should try to define this method.
-
#tickets(*options) ⇒ Object
All providers should try to define this method.
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 (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
35 36 37 |
# File 'lib/ticketmaster/provider.rb', line 35 def project(*) easy_finder(@provider::Project, :first, ) end |
#project!(*options) ⇒ Object
Create a project same as project.create()
48 49 50 |
# File 'lib/ticketmaster/provider.rb', line 48 def project!(*) project.create(*) 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
43 44 45 |
# File 'lib/ticketmaster/provider.rb', line 43 def projects(*) easy_finder(@provider::Project, :all, ) 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
62 63 64 |
# File 'lib/ticketmaster/provider.rb', line 62 def ticket(*) easy_finder(@provider::Ticket, :first, ) 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
70 71 72 |
# File 'lib/ticketmaster/provider.rb', line 70 def tickets(*) easy_finder(@provider::Ticket, :all, ) end |