class AgileTrello::CardHistory

Constants

MOVEMENT_ACTION_TYPE
MOVEMENT_DATA_ATTRIBUTE
MOVEMENT_DATA_LIST_NAME

Public Class Methods

new(trello_card, all_lists_on_board) click to toggle source
# 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

Public Instance Methods

find_date_entered_list(list_name) click to toggle source
# 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