Module: TaskMapper::Provider::Jira

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

Overview

This is the Jira Provider for taskmapper

Defined Under Namespace

Classes: Comment, Project, Ticket

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(auth = {}) ⇒ Object

This is for cases when you want to instantiate using TaskMapper::Provider::Jira.new(auth)



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

def self.new(auth = {})
  TaskMapper.new(:jira, auth)
end

Instance Method Details

#authorize(auth = {}) ⇒ Object

Providers must define an authorize method. This is used to initialize and set authentication parameters to access the API



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/provider/jira.rb', line 15

def authorize(auth = {})
  @authentication ||= TaskMapper::Authenticator.new(auth)
  $jira = Jira4R::JiraTool.new(2,@authentication.url)
  begin 
    $jira.(@authentication.username, @authentication.password)
    @valid_auth = true
  rescue
    @valid_auth = false
  end
  # Set authentication parameters for whatever you're using to access the API
end

#project(*options) ⇒ Object

declare needed overloaded methods here



29
30
31
32
33
34
35
36
37
38
# File 'lib/provider/jira.rb', line 29

def project(*options)
  if options.first.is_a? String
    options[0] = options[0].to_i
  end
  if options.first.is_a? Fixnum
    Project.find_by_id(options.first)
  elsif options.first.is_a? Hash
    Project.find_by_attributes(options.first).first
  end
end

#valid?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/provider/jira.rb', line 40

def valid?
  @valid_auth
end