Class: VtsTrelloDeliver::Deliverer

Inherits:
Object
  • Object
show all
Defined in:
lib/vts-trello-deliver/deliverer.rb

Instance Method Summary collapse

Constructor Details

#initialize(git, developer_public_key, member_token) ⇒ Deliverer

Returns a new instance of Deliverer.



6
7
8
9
10
11
12
13
# File 'lib/vts-trello-deliver/deliverer.rb', line 6

def initialize(git, developer_public_key, member_token)
  @git = git

  Trello.configure do |config|
    config.developer_public_key = developer_public_key
    config.member_token = member_token
  end
end

Instance Method Details

#deliver(from_list, to_list) ⇒ Object



15
16
17
18
19
20
# File 'lib/vts-trello-deliver/deliverer.rb', line 15

def deliver(from_list, to_list)
  Trello::List.find(from_list).cards.each do |card|
    id = card.short_url.gsub('https://trello.com/c/', '')
    Trello::Card.find(id).move_to_list(to_list) if @git.contains?(id)
  end
end