taskmapper-github 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.2
1
+ 0.10.4
@@ -12,23 +12,27 @@ module TaskMapper::Provider
12
12
  TaskMapper.new(:github, auth)
13
13
  end
14
14
 
15
- def provider
16
- TaskMapper::Provider::Github
17
- end
18
-
19
- def new_github_client(auth)
20
- Octokit::Client.new auth
21
- end
22
-
23
15
  # declare needed overloaded methods here
24
16
  def authorize(auth = {})
25
- auth[:login] = auth[:login] || auth[:username]
26
- raise TaskMapper::Exception.new('Please provide at least a username') if auth[:login].blank?
27
- provider.login = auth[:login]
28
- provider.user_token = auth[:password] || auth[:oauth_token]
29
- provider.api = new_github_client auth
17
+ @authentication ||= TaskMapper::Authenticator.new(auth)
18
+ auth = @authentication
19
+ login = auth.login || auth.username
20
+ if auth.login.blank? and auth.username.blank?
21
+ raise TaskMapper::Exception.new('Please provide at least a username')
22
+ elsif auth.token
23
+ TaskMapper::Provider::Github.login = login
24
+ TaskMapper::Provider::Github.user_token = auth.token
25
+ TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :token => auth.token)
26
+ elsif auth.password
27
+ TaskMapper::Provider::Github.login = login
28
+ TaskMapper::Provider::Github.user_token = auth.token
29
+ TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :password => auth.password)
30
+ else
31
+ TaskMapper::Provider::Github.login = login
32
+ TaskMapper::Provider::Github.user_token = nil
33
+ TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login)
34
+ end
30
35
  end
31
-
32
36
 
33
37
  def valid?
34
38
  TaskMapper::Provider::Github.api.authenticated? || TaskMapper::Provider::Github.api.oauthed?
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "taskmapper-github"
8
- s.version = "0.10.3"
8
+ s.version = "0.10.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["HybridGroup"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskmapper-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  segments:
183
183
  - 0
184
- hash: 105230157
184
+ hash: -366567343
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  none: false
187
187
  requirements: