Module: TimeTrello

Defined in:
lib/time_trello/duration.rb,
lib/time_trello.rb,
lib/time_trello/parser.rb,
lib/time_trello/report.rb,
lib/time_trello/version.rb,
lib/time_trello/trello_driver.rb,
lib/time_trello/activity_record.rb

Overview

--ruby-- Copyright © 2016 - Formaweb - All rights reserved

Author

Ronaldo Faria Lima

Created

2016-03-21

Describes a duration in hours and minutes and proper operations using those.

Defined Under Namespace

Classes: ActivityRecord, Duration, Parser, Report, TrelloDriver

Constant Summary collapse

VERSION =
'1.0.2'

Class Method Summary collapse

Class Method Details

.find_all(start_date, end_date, board_id, &filter) ⇒ Object

Public: Generates the report based on the provided parameters.

start_date - The start date to limit the results. end_date - The end date to limit the results. board_id - Identification of the board that should be parsed in order to

return results.

filter - A block containing a filter for the results. The block must receive

a parameter which is an instance of ActivityRecord.


42
43
44
# File 'lib/time_trello.rb', line 42

def self.find_all(start_date, end_date, board_id, &filter)
  self.report(start_date, end_date, board_id).find_all(&filter)
end

.initialize(public_key, member_token, prefix = ':clock12:') ⇒ Object



26
27
28
29
30
31
32
# File 'lib/time_trello.rb', line 26

def self.initialize(public_key, member_token, prefix = ':clock12:')
  @prefix = prefix
  Trello.configure do |config|
    config.developer_public_key = public_key
    config.member_token = member_token
  end
end

.report(start_date, end_date, board_id) ⇒ Object

Private: Getter for a report instance. Guarantees only one single instance available for caching optimization.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/time_trello.rb', line 48

def self.report(start_date, end_date, board_id)
  if @report.nil?
    @report = Report.new(start_date, end_date, board_id, @prefix)
  else
    # Updates report parameters
    @report.start_date = start_date
    @report.end_date = end_date
    @report.board_id = board_id
  end
  
  @report
end