Class: GHX::Issue
- Inherits:
-
Object
- Object
- GHX::Issue
- Defined in:
- lib/ghx/issue.rb
Instance Attribute Summary collapse
-
#assignees ⇒ Object
Returns the value of attribute assignees.
-
#author ⇒ Object
Returns the value of attribute author.
-
#body ⇒ Object
Returns the value of attribute body.
-
#closed_at ⇒ Object
Returns the value of attribute closed_at.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#milestone ⇒ Object
Returns the value of attribute milestone.
-
#number ⇒ Object
Returns the value of attribute number.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#state ⇒ Object
Returns the value of attribute state.
-
#state_reason ⇒ Object
Returns the value of attribute state_reason.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(owner:, repo:, **args) ⇒ Issue
constructor
A new instance of Issue.
- #save ⇒ Object
Constructor Details
#initialize(owner:, repo:, **args) ⇒ Issue
Returns a new instance of Issue.
21 22 23 24 25 |
# File 'lib/ghx/issue.rb', line 21 def initialize(owner:, repo:, **args) @owner = owner @repo = repo update_attributes(args) end |
Instance Attribute Details
#assignees ⇒ Object
Returns the value of attribute assignees.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def assignees @assignees end |
#author ⇒ Object
Returns the value of attribute author.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def @author end |
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def body @body end |
#closed_at ⇒ Object
Returns the value of attribute closed_at.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def closed_at @closed_at end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def created_at @created_at end |
#labels ⇒ Object
Returns the value of attribute labels.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def labels @labels end |
#milestone ⇒ Object
Returns the value of attribute milestone.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def milestone @milestone end |
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def number @number end |
#owner ⇒ Object
Returns the value of attribute owner.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def owner @owner end |
#repo ⇒ Object
Returns the value of attribute repo.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def repo @repo end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def state @state end |
#state_reason ⇒ Object
Returns the value of attribute state_reason.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def state_reason @state_reason end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def title @title end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/ghx/issue.rb', line 3 def updated_at @updated_at end |
Class Method Details
.find(owner:, repo:, number:) ⇒ Object
16 17 18 19 |
# File 'lib/ghx/issue.rb', line 16 def self.find(owner:, repo:, number:) response_data = GHX.rest_client.get("repos/#{owner}/#{repo}/issues/#{number}") new(owner: owner, repo: repo, **response_data) end |
.search(owner:, repo:, query:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ghx/issue.rb', line 5 def self.search(owner:, repo:, query:) data = GHX.rest_client.get("search/issues?q=#{URI.encode_www_form_component(query)}+is:issue+repo:#{owner}/#{repo}") data.fetch("items").to_a.map do |issue_data| new(owner: owner, repo: repo, **issue_data) end rescue => e GHX.logger.error "Error searching for issues with query: #{e.}" GHX.logger.error "Received data: #{data}" [] end |
Instance Method Details
#save ⇒ Object
27 28 29 |
# File 'lib/ghx/issue.rb', line 27 def save @number.nil? ? create : update end |