Class: AgileTrello::CardHistory
- Inherits:
-
Object
- Object
- AgileTrello::CardHistory
- Defined in:
- lib/CardHistory.rb
Constant Summary collapse
- MOVEMENT_ACTION_TYPE =
'updateCard'- MOVEMENT_DATA_ATTRIBUTE =
'listAfter'- MOVEMENT_DATA_LIST_NAME =
'name'
Instance Method Summary collapse
- #find_date_entered_list(list_name) ⇒ Object
-
#initialize(trello_card, all_lists_on_board) ⇒ CardHistory
constructor
A new instance of CardHistory.
Constructor Details
#initialize(trello_card, all_lists_on_board) ⇒ CardHistory
Returns a new instance of CardHistory.
7 8 9 10 11 12 |
# File 'lib/CardHistory.rb', line 7 def initialize(trello_card, all_lists_on_board) @card_movements = trello_card.actions.select do | action | action.type == MOVEMENT_ACTION_TYPE && !action.data[MOVEMENT_DATA_ATTRIBUTE].nil? end @all_lists_on_board = all_lists_on_board end |
Instance Method Details
#find_date_entered_list(list_name) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/CardHistory.rb', line 14 def find_date_entered_list(list_name) @card_movements.each do |movement| return movement.date if movement.data[MOVEMENT_DATA_ATTRIBUTE][MOVEMENT_DATA_LIST_NAME].include?(list_name) end current_index = @all_lists_on_board.index { |board_list_name| board_list_name.include? list_name } next_list_name = @all_lists_on_board[current_index + 1] find_date_entered_list(next_list_name) end |