Created
January 12, 2015 05:47
-
-
Save pdxmph/ae6ec1c541c768ee1379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'trello' | |
require 'appscript' | |
include Trello | |
include Appscript | |
# There's a little setup involved here. | |
# Step 1. Get Your Application Key from here: | |
# https://trello.com/1/appKey/generate | |
public_key = "" | |
# Step 2. Get Your Token to Approve Your "App" from here: | |
# https://trello.com/1/authorize?key=YOUR_APPLICATION_KEY_FROM_STEP_1&name=SOME_ARBITRARY_NAME&expiration=never&response_type=token&scope=read,write | |
member_token = "" | |
# Step 3. Set up misc. variables | |
board_name = "" | |
list_name = "" | |
username = "" | |
# Nothing too user-serviceable down here | |
mail = app("Mail.app") | |
Trello.configure do |config| | |
config.developer_public_key = public_key | |
config.member_token = member_token | |
end | |
user = Member.find(username) | |
board = user.boards.select { |b| b.name == board_name }.first | |
list = board.lists.select { |l| l.name == list_name }.first | |
messages = mail.selection.get | |
messages.each do |m| | |
card_title = m.subject.get | |
id = m.message_id.get | |
content = m.content.get | |
message_content = "message://%3c#{id}%3e\n\n#{content}" | |
card = Card.create(:name => card_title, :desc => message_content, :list_id => list.id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment