Class: Octopi::Issue
- Octopi::Base
- Octopi::Issue
Included Modules
Attributes
Instance Attributes
body | [RW] | public |
Sets the attribute body. |
---|---|---|---|
closed_at | [RW] | public |
Sets the attribute closed_at. |
created_at | [RW] | public |
Sets the attribute created_at. |
labels | [RW] | public |
Sets the attribute labels. |
number | [RW] | public |
Sets the attribute number. |
repository | [RW] | public |
Sets the attribute repository. |
state | [RW] | public |
Sets the attribute state. |
title | [RW] | public |
Sets the attribute title. |
updated_at | [RW] | public |
Sets the attribute updated_at. |
user | [RW] | public |
Sets the attribute user. |
votes | [RW] | public |
Sets the attribute votes. |
Constants
- STATES
- %w{open closed}
Constants Inherited from Octopi::Base
Constructor Summary
This class inherits a constructor from Octopi::Base.
Public Visibility
Public Class Method Summary
find(opts = {}) |
TODO: Make find use hashes like find_all. |
---|---|
find_all(opts = {}) |
Finds all issues for a given Repository. |
open(opts = {}) |
Public Instance Method Summary
#close! | |
---|---|
#comment(comment) | |
#reopen! |
Re-opens an issue. |
#save |
Public Instance Methods Inherited from Octopi::Base
Public Class Method Details
find
TODO: Make find use hashes like find_all
37 38 39 40 41 42 43 44 |
# File 'lib/octopi/issue.rb', line 37 def self.find(opts={}) user, repo = gather_details(opts) validate_args(user => :user, repo => :repo) issue = super user, repo, opts[:number] issue.repository = repo issue end |
find_all
Finds all issues for a given Repository
You can provide the user and repo parameters as String or as User and Repository objects. When repo is provided as a Repository object, user is superfluous.
If no state is given, "open" is assumed.
Sample usage:
find_all(repo, :state => "closed") # repo must be an object find_all("octopi", :user => "fcoury") # user must be provided find_all(:user => "fcoury", :repo => "octopi") # state defaults to open
26 27 28 29 30 31 32 33 34 |
# File 'lib/octopi/issue.rb', line 26 def self.find_all(opts={}) user, repo = gather_details(opts) state = (opts[:state] || "open").downcase validate_args(user => :user, repo.name => :repo, state => :state) issues = super user, repo.name, state issues.each { |i| i.repository = repo } issues end |
open
46 47 48 49 50 51 52 |
# File 'lib/octopi/issue.rb', line 46 def self.open(opts={}) user, repo = gather_details(opts) data = Api.api.post("/issues/open/#{user}/#{repo.name}", opts[:params]) issue = new(data['issue']) issue.repository = repo issue end |
Public Instance Method Details
close!
61 62 63 64 65 |
# File 'lib/octopi/issue.rb', line 61 def close! data = Api.api.post(command_path("close")) self.state = 'closed' self end |
comment
reopen!
Re-opens an issue.
55 56 57 58 59 |
# File 'lib/octopi/issue.rb', line 55 def reopen! data = Api.api.post(command_path("reopen")) self.state = 'open' self end |
save
67 68 69 70 |
# File 'lib/octopi/issue.rb', line 67 def save data = Api.api.post(command_path("edit"), { :title => title, :body => body }) self end |