Module: TaskMapper::Provider::Base
- Includes:
- Helper
- Defined in:
- lib/taskmapper/ticket.rb,
lib/taskmapper/comment.rb,
lib/taskmapper/project.rb,
lib/taskmapper/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.
-
#valid? ⇒ Boolean
All providers must 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 TaskMapper::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/taskmapper/provider.rb', line 24 def (authentication = {}) @authentication = TaskMapper::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
taskmapper.project.find :all
taskmapper.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/taskmapper/provider.rb', line 41 def project(*) easy_finder(@provider::Project, :first, ) end |
#project!(*options) ⇒ Object
Create a project same as project.create()
54 55 56 |
# File 'lib/taskmapper/provider.rb', line 54 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
49 50 51 |
# File 'lib/taskmapper/provider.rb', line 49 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
taskmapper.ticket.find :all
taskmapper.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/taskmapper/provider.rb', line 68 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
76 77 78 |
# File 'lib/taskmapper/provider.rb', line 76 def tickets(*) easy_finder(@provider::Ticket, :all, ) end |
#valid? ⇒ Boolean
All providers must define this method. It should implement the code for validating the authentication
30 31 32 |
# File 'lib/taskmapper/provider.rb', line 30 def valid? raise TaskMapper::Exception.new("#{Base.name}::#{this_method} method must be implemented by the provider") end |