Class: Jiralicious::SearchResult
- Inherits:
-
Object
- Object
- Jiralicious::SearchResult
- Defined in:
- lib/jiralicious/search_result.rb
Overview
The SearchResult class organizes the response from the Jira API In a way that is easily parsable into Issues.
Instance Attribute Summary collapse
-
#num_results ⇒ Object
readonly
Attributes available for usage regarding the current position in the list.
-
#offset ⇒ Object
readonly
Attributes available for usage regarding the current position in the list.
Instance Method Summary collapse
-
#initialize(search_data) ⇒ SearchResult
constructor
Initialization Method.
-
#issues ⇒ Object
Loads the different issues through the map.
-
#issues_raw ⇒ Object
Returns the Issues attribute without loading the extra information.
Constructor Details
#initialize(search_data) ⇒ SearchResult
Initialization Method
Parses the hash into attributes.
- Arguments
-
:search_data (required) hash data to be parsed
18 19 20 21 22 |
# File 'lib/jiralicious/search_result.rb', line 18 def initialize(search_data) @issues = search_data["issues"] @offset = search_data["startAt"] @num_results = search_data["total"] end |
Instance Attribute Details
#num_results ⇒ Object (readonly)
Attributes available for usage regarding the current position in the list
8 9 10 |
# File 'lib/jiralicious/search_result.rb', line 8 def num_results @num_results end |
#offset ⇒ Object (readonly)
Attributes available for usage regarding the current position in the list
8 9 10 |
# File 'lib/jiralicious/search_result.rb', line 8 def offset @offset end |
Instance Method Details
#issues ⇒ Object
Loads the different issues through the map. This is not recommended for large objects as it can be troublesome to load multiple Issues to locate the desired one. If the user needs to have all of the information available on each issue this method works perfectly for that process.
31 32 33 34 35 |
# File 'lib/jiralicious/search_result.rb', line 31 def issues @issues.map do |issue| Jiralicious::Issue.find(issue["key"]) end end |
#issues_raw ⇒ Object
Returns the Issues attribute without loading the extra information. Ideal for a quick scan of the Hash prior to selecting the correct Issue. This method is also used in the lazy loading methodology.
42 43 44 |
# File 'lib/jiralicious/search_result.rb', line 42 def issues_raw @issues end |