Module: Trellatin::Persistence::ClassMethods

Defined in:
lib/trellatin/persistence.rb

Instance Method Summary collapse

Instance Method Details

#configure_clientObject



28
29
30
31
32
33
# File 'lib/trellatin/persistence.rb', line 28

def configure_client
  Trello.configure do |config|
    config.developer_public_key = options[:app_key] || Trellatin::Config.app_key
    config.member_token         = options[:token]   || Trellatin::Config.token
  end
end

#set_boardObject



45
46
47
# File 'lib/trellatin/persistence.rb', line 45

def set_board
  self.board = owner.boards.select { |b| b.name == options[:board] }.first
end

#set_listObject



49
50
51
# File 'lib/trellatin/persistence.rb', line 49

def set_list
  self.list = board.lists.select { |l| l.name == options[:list] }.first
end

#set_ownerObject



41
42
43
# File 'lib/trellatin/persistence.rb', line 41

def set_owner
  self.owner = Trello::Member.find(options[:owner])
end

#set_trello_objectsObject



35
36
37
38
39
# File 'lib/trellatin/persistence.rb', line 35

def set_trello_objects
  self.set_owner
  self.set_board
  self.set_list
end

#trellatin(options = {}) ⇒ Object



53
54
55
56
57
# File 'lib/trellatin/persistence.rb', line 53

def trellatin(options = {})
  self.options = options
  configure_client
  set_trello_objects
end