Class: Taskit::Issue
- Inherits:
-
Object
- Object
- Taskit::Issue
- Defined in:
- lib/taskit/issue.rb
Overview
An issue object, used to normalize the GitHub API response
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#repo_url ⇒ Object
readonly
Returns the value of attribute repo_url.
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(data) ⇒ Issue
constructor
A new instance of Issue.
- #load_issue_info(data) ⇒ Object
- #load_repo_info(data) ⇒ Object
- #load_state_info(data) ⇒ Object
Constructor Details
#initialize(data) ⇒ Issue
Returns a new instance of Issue.
13 14 15 16 17 |
# File 'lib/taskit/issue.rb', line 13 def initialize(data) load_repo_info data load_issue_info data load_state_info data end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def body @body end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def id @id end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def labels @labels end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def number @number end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def owner @owner end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def repo @repo end |
#repo_url ⇒ Object (readonly)
Returns the value of attribute repo_url.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def repo_url @repo_url end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def reporter @reporter end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def state @state end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/taskit/issue.rb', line 9 def url @url end |
Instance Method Details
#load_issue_info(data) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/taskit/issue.rb', line 26 def load_issue_info(data) @url, @id, @number, @title, @body = data.to_h.values_at( :html_url, :id, :number, :title, :body ) @reporter = data[:user][:login] end |
#load_repo_info(data) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/taskit/issue.rb', line 19 def load_repo_info(data) repo_info = data[:repository] @repo = repo_info[:name] @repo_url = repo_info[:html_url] @owner = repo_info[:owner][:login] end |