Module: TicketMaster::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 ticketmaster
Defined Under Namespace
Classes: Comment, Project, Ticket
Class Attribute Summary collapse
-
.api ⇒ Object
Returns the value of attribute api.
-
.login ⇒ Object
Returns the value of attribute login.
Class Method Summary collapse
-
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth).
Instance Method Summary collapse
-
#authorize(auth = {}) ⇒ Object
declare needed overloaded methods here.
- #project(*project) ⇒ Object
- #projects(*options) ⇒ Object
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 |
Class Method Details
.new(auth = {}) ⇒ Object
This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth)
11 12 13 |
# File 'lib/provider/github.rb', line 11 def self.new(auth = {}) TicketMaster.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 |
# File 'lib/provider/github.rb', line 16 def (auth = {}) @authentication ||= TicketMaster::Authenticator.new(auth) auth = @authentication if auth.login.blank? and auth.username.blank? raise TicketMaster::Exception.new('Please provide at least a username') elsif auth.token.blank? TicketMaster::Provider::Github.login = auth.login || auth.username TicketMaster::Provider::Github.api = Octokit.client(:login => auth.login) else TicketMaster::Provider::Github.login = auth.login || auth.username TicketMaster::Provider::Github.api = Octokit.client(:login => auth.login, :token => auth.token) end end |
#project(*project) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/provider/github.rb', line 40 def project(*project) unless project.empty? Project.find_by_id(project.first) else super end end |
#projects(*options) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/provider/github.rb', line 30 def projects(*) if .empty? Project.find_all() elsif .first.is_a? Array .first.collect { |name| Project.find_by_id(name) } elsif .first.is_a? Hash Project.find_by_attributes(.first) end end |