Skip to content
This repository
tag: v0.3.0
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 28 lines (23 sloc) 1.221 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
$LOAD_PATH.unshift 'lib'
require 'trello'

include Trello
include Trello::Authorization

Trello::Authorization.const_set :AuthPolicy, OAuthPolicy

# First arg is your public key, and second is secret.
# You can get this info by going to:
# https://trello.com/1/appKey/generate
OAuthPolicy.consumer_credential = OAuthCredential.new 'PUBLIC_KEY', 'SECRET'
# First arg is the access token key, second is presently not used -- trello bug?
# You can get the key by going to this url in your browser:
# https://trello.com/1/connect?key=PUBLIC_KEY_FROM_ABOVE&name=MyApp&response_type=token&scope=read,write,account&expiration=never
# Only request the permissions you need; i.e., scope=read if you only need read, or scope=write if you only need write. Comma separate scopes you need.
# If you want your token to expire after 30 days, drop the &expiration=never.
OAuthPolicy.token = OAuthCredential.new 'ACCESS_TOKEN_KEY', nil

me = Member.find("me")
board = Board.create(:name => "ruby-trello test")
if board.has_lists?
  list = board.lists.first
else
  list = List.create(:name => "Getting Shit done", :board_id => board.id)
end
Card.create(:name => "test from ruby-trello", :description => "Just a desc", :list_id => list.id)
Something went wrong with that request. Please try again.