Class: Afterburn::List

Inherits:
TrelloObjectWrapper show all
Defined in:
lib/afterburn/list.rb

Defined Under Namespace

Modules: History, Role Classes: UnknownRole

Instance Attribute Summary

Attributes inherited from TrelloObjectWrapper

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TrelloObjectWrapper

#fetch, fetch, find, inherited, #initialize, initialize_from_trello_object, #load, #redis_key, #trello_object, #trello_object=, wrap, wrapper_class, wrapper_name, #wrapper_name

Methods included from Helpers

#constantize, #redis, #titleize

Constructor Details

This class inherits a constructor from Afterburn::TrelloObjectWrapper

Class Method Details

.factory(trello_list) ⇒ Object



34
35
36
37
38
# File 'lib/afterburn/list.rb', line 34

def self.factory(trello_list)
  initialize_from_trello_object(trello_list).tap do |list|
    list.extend(History) if Role.historical?(list.role)
  end
end

.historical(list) ⇒ Object



40
41
42
# File 'lib/afterburn/list.rb', line 40

def self.historical(list)
  HistoricalList.initialize_from_trello_object(list.trello_list)
end

.rolesObject



30
31
32
# File 'lib/afterburn/list.rb', line 30

def self.roles
  Role::VALID_ROLES
end

Instance Method Details

#card_countObject



61
62
63
# File 'lib/afterburn/list.rb', line 61

def card_count
  trello_cards.count
end

#nameObject



44
45
46
# File 'lib/afterburn/list.rb', line 44

def name
  trello_list.name
end

#roleObject



53
54
55
# File 'lib/afterburn/list.rb', line 53

def role
  role_store.value
end

#role=(role) ⇒ Object

Raises:



48
49
50
51
# File 'lib/afterburn/list.rb', line 48

def role=(role)
  raise UnknownRole.new("Tried to set unrecognized '#{role}'") unless Role.valid?(role)
  role_store.value = role
end

#timestamp_count_vector(timestamps) ⇒ Object



65
66
67
# File 'lib/afterburn/list.rb', line 65

def timestamp_count_vector(timestamps)
  ListMetric.timestamp_count_vector(self, timestamps)
end

#trello_cardsObject



57
58
59
# File 'lib/afterburn/list.rb', line 57

def trello_cards
  trello_list.cards
end

#update_attributes(attributes) ⇒ Object



69
70
71
72
73
# File 'lib/afterburn/list.rb', line 69

def update_attributes(attributes)
  attributes.each do |key, value|
    send("#{key}=", value)
  end
end