Module: TaskMapper::Provider::Github
- Includes:
- Base
- Defined in:
- lib/provider/github.rb,
lib/provider/octokit_wrapper.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, OctokitWrapper, Project, Ticket
Class Attribute Summary collapse
-
.api ⇒ Object
Returns the value of attribute api.
-
.login ⇒ Object
Returns the value of attribute login.
-
.user_token ⇒ Object
Returns the value of attribute user_token.
Class Method Summary collapse
-
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TaskMapper::Provider::Github.new(auth).
Instance Method Summary collapse
-
#authorize(auth = {}) ⇒ Object
declare needed overloaded methods here.
- #new_github_client(auth) ⇒ Object
- #provider ⇒ Object
- #valid? ⇒ Boolean
Class Attribute Details
.api ⇒ Object
Returns the value of attribute api.
7 8 9 |
# File 'lib/provider/github.rb', line 7 def api @api end |
.login ⇒ Object
Returns the value of attribute login.
7 8 9 |
# File 'lib/provider/github.rb', line 7 def login @login end |
.user_token ⇒ Object
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
24 25 26 27 28 29 30 31 |
# File 'lib/provider/github.rb', line 24 def (auth = {}) @authentication ||= TaskMapper::Authenticator.new(auth) auth[:login] = auth.fetch(:login) || auth.fetch(:username) raise TaskMapper::Exception.new('Please provide at least a username') if auth[:login].blank? provider.login = auth[:login] provider.user_token = auth[:password] || auth[:token] provider.api = new_github_client auth end |
#new_github_client(auth) ⇒ Object
19 20 21 |
# File 'lib/provider/github.rb', line 19 def new_github_client(auth) Octokit::Client.new auth end |
#provider ⇒ Object
15 16 17 |
# File 'lib/provider/github.rb', line 15 def provider TaskMapper::Provider::Github end |
#valid? ⇒ Boolean
33 34 35 |
# File 'lib/provider/github.rb', line 33 def valid? provider.api.authenticated? || provider.api.oauthed? end |