Class: TimeTrello::Report
- Inherits:
-
Object
- Object
- TimeTrello::Report
- Defined in:
- lib/time_trello/report.rb
Overview
Public: This class represents a report manager on the time trello structure. It coordinates efforts with the persistence manager in order to collect data from a given trello board.
Instance Attribute Summary collapse
-
#board_id ⇒ Object
Public: board identification for reporting.
-
#end_date ⇒ Object
Public: Report end date.
-
#prefix ⇒ Object
Public: Prefix for proper filtering.
-
#start_date ⇒ Object
Public: Report start date.
Instance Method Summary collapse
-
#find_all(&filter) ⇒ Object
Public: Generates the report based on a filter, if provided.
-
#initialize(start_date, end_date, board_id, prefix) ⇒ Report
constructor
Public: Initializes this class providing initial filter information.
Constructor Details
#initialize(start_date, end_date, board_id, prefix) ⇒ Report
Public: Initializes this class providing initial filter information
start_date - Used to limit the result set. It is the start of time records end_date - Used to limit the result set. It is the end of time records board_id - Identification of the given board. Used to grab information from an specific board.
32 33 34 35 36 37 |
# File 'lib/time_trello/report.rb', line 32 def initialize(start_date, end_date, board_id, prefix) @start_date = start_date @end_date = end_date @board_id = board_id @prefix = prefix end |
Instance Attribute Details
#board_id ⇒ Object
Public: board identification for reporting
24 25 26 |
# File 'lib/time_trello/report.rb', line 24 def board_id @board_id end |
#end_date ⇒ Object
Public: Report end date
22 23 24 |
# File 'lib/time_trello/report.rb', line 22 def end_date @end_date end |
#prefix ⇒ Object
Public: Prefix for proper filtering
18 19 20 |
# File 'lib/time_trello/report.rb', line 18 def prefix @prefix end |
#start_date ⇒ Object
Public: Report start date
20 21 22 |
# File 'lib/time_trello/report.rb', line 20 def start_date @start_date end |
Instance Method Details
#find_all(&filter) ⇒ Object
Public: Generates the report based on a filter, if provided. The filter is a block that will filter the result set accordingly. The result set is
- always an array containing instances of ActivityRecord. See
-
ActivityRecord
filter - Block used to filter the result set even further. It must follow the same format for the block passed as parameter to Array.find_all method. Each element on the array is, in fact, an instance of TimeTrello::ActivityRecord
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/time_trello/report.rb', line 48 def find_all &filter driver = TrelloDriver.new(@board_id, @prefix) result_set = driver.activities.find_all { |activity| activity.start_date >= @start_date && activity.start_date <= @end_date } if filter return result_set.find_all &filter end result_set end |