class TimeTrello::Report
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.
Attributes
Public: board identification for reporting
Public: Report
end date
Public: Prefix for proper filtering
Public: Report
start date
Public Class Methods
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.
# File lib/time_trello/report.rb, line 40 def initialize(start_date, end_date, board_id, prefix) @start_date = start_date @end_date = end_date @board_id = board_id @prefix = prefix end
Public Instance Methods
Public: Setter. Overrides the board_id
setter in order to re-initialize the driver properly with new settings.
# File lib/time_trello/report.rb, line 68 def board_id=(board_id) if board_id != @board_id @board_id = board_id # Forces the driver reload with the new settings @driver = nil end end
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 -
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
# File lib/time_trello/report.rb, line 56 def find_all &filter result_set = self.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
Protected Instance Methods
Private: Getter for trello driver.
# File lib/time_trello/report.rb, line 18 def driver @driver = TrelloDriver.new(@board_id, @prefix) if @driver == nil @driver end