Class: Gitcamp::Github::Issue
- Inherits:
-
Object
- Object
- Gitcamp::Github::Issue
- Defined in:
- lib/gitcamp/github/issue.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
readonly
Returns the value of attribute github.
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
-
#milestone ⇒ Object
readonly
Returns the value of attribute milestone.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#todo ⇒ Object
readonly
Returns the value of attribute todo.
-
#todolist ⇒ Object
readonly
Returns the value of attribute todolist.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Issue
constructor
A new instance of Issue.
- #save ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Issue
Returns a new instance of Issue.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gitcamp/github/issue.rb', line 6 def initialize( = {}) unless [:todo] raise ArgumentError, 'no Basecamp todo given' end @github = [:github] @repo = [:repo] @milestone = [:milestone] @todo = [:todo] @todolist = [:todolist] @title = @todo.content.gsub(/#\d+\s+/, '') end |
Instance Attribute Details
#github ⇒ Object (readonly)
Returns the value of attribute github.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def github @github end |
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def issue @issue end |
#milestone ⇒ Object (readonly)
Returns the value of attribute milestone.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def milestone @milestone end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def repo @repo end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def title @title end |
#todo ⇒ Object (readonly)
Returns the value of attribute todo.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def todo @todo end |
#todolist ⇒ Object (readonly)
Returns the value of attribute todolist.
4 5 6 |
# File 'lib/gitcamp/github/issue.rb', line 4 def todolist @todolist end |
Instance Method Details
#save ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gitcamp/github/issue.rb', line 20 def save issues = @github.list_issues(repo, milestone: milestone.number) @issue = issues.find { |issue| issue.title == title } if @issue @issue = @github.update_issue(repo, issue.number, issue.title, issue.body, milestone: milestone.number, labels: 'basecamp') else @issue = @github.create_issue(repo, title, '', milestone: milestone.number, labels: 'basecamp') todo = Gitcamp::Basecamp::Todo.new(list: todolist, issue: issue, find_by_title: true) todo.save end say "Processed issue '#{issue.title}' in GitHub" end |