Class: TaskMapper
- Inherits:
-
Object
- Object
- TaskMapper
- Defined in:
- lib/taskmapper.rb,
lib/taskmapper.rb
Overview
This is the TaskMapper class
Defined Under Namespace
Modules: Provider Classes: Authenticator, Exception
Instance Attribute Summary collapse
-
#default_project ⇒ Object
Returns the value of attribute default_project.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#authorize(authentication = {}) ⇒ Object
Providers should over-write this method.
-
#initialize(system = nil, authentication = nil) ⇒ TaskMapper
constructor
This initializes the TaskMapper instance and prepares the provider If called without any arguments, it conveniently tries searching for the information in ~/.taskmapper.yml See the documentation for more information on the format of that file.
Constructor Details
#initialize(system = nil, authentication = nil) ⇒ TaskMapper
This initializes the TaskMapper instance and prepares the provider If called without any arguments, it conveniently tries searching for the information in ~/.taskmapper.yml See the documentation for more information on the format of that file.
What it DOES NOT do is auto-require the provider…so make sure you have the providers required.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/taskmapper.rb', line 36 def initialize(system = nil, authentication = nil) if system.nil? or authentication.nil? require 'yaml' data = YAML.load_file File.(ENV['TASKMAPPER_CONFIG'] || '~/.taskmapper.yml') system = system.nil? ? data['default'] || data.first.first : system.to_s authentication = data[system]['authentication'] if authentication.nil? and data[system]['authentication'] end self.extend TaskMapper::Provider.const_get(system.to_s.capitalize) authentication @symbol = system.to_sym @provider = TaskMapper::Provider.const_get(system.to_s.capitalize) end |
Instance Attribute Details
#default_project ⇒ Object
Returns the value of attribute default_project.
28 29 30 |
# File 'lib/taskmapper.rb', line 28 def default_project @default_project end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
27 28 29 |
# File 'lib/taskmapper.rb', line 27 def provider @provider end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
27 28 29 |
# File 'lib/taskmapper.rb', line 27 def symbol @symbol end |
Instance Method Details
#authorize(authentication = {}) ⇒ Object
Providers should over-write this method
50 51 52 |
# File 'lib/taskmapper.rb', line 50 def (authentication = {}) raise TaskMapper::Exception.new("This method must be reimplemented in the provider") end |