Module: TaskMapper::Provider::Github

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

Overview

This is the Github Provider for taskmapper

Defined Under Namespace

Classes: Comment, Project, Ticket

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api.



7
8
9
# File 'lib/provider/github.rb', line 7

def api
  @api
end

.loginObject

Returns the value of attribute login.



7
8
9
# File 'lib/provider/github.rb', line 7

def 
  @login
end

.user_tokenObject

Returns the value of attribute user_token.



7
8
9
# File 'lib/provider/github.rb', line 7

def user_token
  @user_token
end

Class Method Details

.new(auth = {}) ⇒ Object

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



11
12
13
# File 'lib/provider/github.rb', line 11

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

Instance Method Details

#authorize(auth = {}) ⇒ Object

declare needed overloaded methods here



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/provider/github.rb', line 16

def authorize(auth = {})
  @authentication ||= TaskMapper::Authenticator.new(auth)
   = @authentication. || @authentication.username
  if .blank?
    raise TaskMapper::Exception.new('Please provide at least a username')
  elsif @authentication.token
    TaskMapper::Provider::Github.api = Octokit::Client.new(:login => , :token => @authentication.token)
  elsif @authentication.password
    TaskMapper::Provider::Github.api = Octokit::Client.new(:login => , :password => @authentication.password)
  else 
    TaskMapper::Provider::Github.api = Octokit::Client.new(:login => )
  end
  TaskMapper::Provider::Github. = 
end

#valid?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/provider/github.rb', line 31

def valid?
  TaskMapper::Provider::Github.api.authenticated? || TaskMapper::Provider::Github.api.oauthed?
end