Class: TimeTrello::TrelloDriver
- Inherits:
-
Object
- Object
- TimeTrello::TrelloDriver
- Defined in:
- lib/time_trello/trello_driver.rb
Overview
Public: Driver responsible to convert data gathered from Trello to an internal representation.
Instance Attribute Summary collapse
-
#board_id ⇒ Object
Returns the value of attribute board_id.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#activities ⇒ Object
Public: Getter.
-
#board ⇒ Object
Public: Getter.
-
#initialize(board_id, prefix) ⇒ TrelloDriver
constructor
A new instance of TrelloDriver.
Constructor Details
#initialize(board_id, prefix) ⇒ TrelloDriver
Returns a new instance of TrelloDriver.
23 24 25 26 27 28 |
# File 'lib/time_trello/trello_driver.rb', line 23 def initialize(board_id, prefix) @board_id = board_id @prefix = prefix @activities = [] @board = nil end |
Instance Attribute Details
#board_id ⇒ Object
Returns the value of attribute board_id.
20 21 22 |
# File 'lib/time_trello/trello_driver.rb', line 20 def board_id @board_id end |
#prefix ⇒ Object
Returns the value of attribute prefix.
21 22 23 |
# File 'lib/time_trello/trello_driver.rb', line 21 def prefix @prefix end |
Instance Method Details
#activities ⇒ Object
Public: Getter. Gets all activities for a given board.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/time_trello/trello_driver.rb', line 38 def activities return @activities if @activities != nil && @activities.length > 0 @activities = [] self.board.cards.each do |card| card.actions.each do |action| member = Trello::Member.find(action.member_creator_id) action_record = {action: action, member: member} activity = (Parser.new(action_record, @prefix)).parse @activities.push(activity) unless activity == nil end end @activities end |
#board ⇒ Object
Public: Getter. Gets a board, based on a board id.
31 32 33 34 35 |
# File 'lib/time_trello/trello_driver.rb', line 31 def board @board = Trello::Board.find(@board_id) if @board == nil @board end |