Class: Cinch::Plugins::Github::Issue
- Inherits:
-
Object
- Object
- Cinch::Plugins::Github::Issue
- Includes:
- Cinch::Plugin, Octopi
- Defined in:
- lib/cinch/plugins/github/issue.rb
Overview
Handles interaction with Issues API.
Class Attribute Summary collapse
-
.author ⇒ Object
Returns the value of attribute author.
-
.repo ⇒ Object
Returns the value of attribute repo.
-
.token ⇒ Object
Returns the value of attribute token.
-
.user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#display_help(m) ⇒ Object
Display Github Issue Help.
-
#get_ticket(m, *args) ⇒ Object
Find ticket with gieven.
-
#issue_link(number) ⇒ Object
Returns the issue as a link.
-
#reply_link(m, arg) ⇒ Object
Return the link of the issue.
-
#search_issue(query, state = 'open') ⇒ Object
Use Github API and Search for the Issue.
Class Attribute Details
.author ⇒ Object
Returns the value of attribute author.
13 14 15 |
# File 'lib/cinch/plugins/github/issue.rb', line 13 def @author end |
.repo ⇒ Object
Returns the value of attribute repo.
13 14 15 |
# File 'lib/cinch/plugins/github/issue.rb', line 13 def repo @repo end |
.token ⇒ Object
Returns the value of attribute token.
13 14 15 |
# File 'lib/cinch/plugins/github/issue.rb', line 13 def token @token end |
.user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/cinch/plugins/github/issue.rb', line 13 def user @user end |
Class Method Details
.configure {|_self| ... } ⇒ Object
15 16 17 |
# File 'lib/cinch/plugins/github/issue.rb', line 15 def configure(&block) yield self end |
Instance Method Details
#display_help(m) ⇒ Object
Display Github Issue Help
26 27 28 29 30 31 32 |
# File 'lib/cinch/plugins/github/issue.rb', line 26 def display_help(m) User(m.user.nick).send (<<-EOF).gsub(/^ {10}/,'') !issue state [open|closed] [query] - query for a ticket with state closed !issue find [query] - query for a ticket with state open !issue link [number] - returns link for issue number. EOF end |
#get_ticket(m, *args) ⇒ Object
Find ticket with gieven
35 36 37 38 39 |
# File 'lib/cinch/plugins/github/issue.rb', line 35 def get_ticket(m, *args) query, state = args.reverse results = search_issue CGI.escape(query), state output m, results.first.last end |
#issue_link(number) ⇒ Object
Returns the issue as a link
54 55 56 |
# File 'lib/cinch/plugins/github/issue.rb', line 54 def issue_link(number) "https://www.github.com/#{self.class.}/#{self.class.repo}/issues/#{number}" end |
#reply_link(m, arg) ⇒ Object
Return the link of the issue
42 43 44 |
# File 'lib/cinch/plugins/github/issue.rb', line 42 def reply_link(m, arg) arg =~ /\D+/ ? m.reply("You need to give me a number...") : m.reply(issue_link(arg)) end |
#search_issue(query, state = 'open') ⇒ Object
Use Github API and Search for the Issue
47 48 49 50 51 |
# File 'lib/cinch/plugins/github/issue.rb', line 47 def search_issue(query, state = 'open') authenticated_with :login => self.class.user, :token => self.class.token do Octopi::Issue.search :user => self.class., :repo => self.class.repo, :state => state, :keyword => query end end |