jeremytregunna/ruby-trello — pull request #42 by rossta (2013-01-16 03:46:19+00:00)
Title: Configurable client

This pull request introduces a configuration DSL typical of other API clients for setting up authorization.

Basic authorization

```ruby
Trello.configure do |config|
config.developer_public_key = TRELLO_DEVELOPER_PUBLIC_KEY
config.member_token = TRELLO_MEMBER_TOKEN
end
```

2-legged OAuth authorization

```ruby
Trello.configure do |config|
config.consumer_key = TRELLO_CONSUMER_KEY
config.consumer_secret = TRELLO_CONSUMER_SECRET
config.oauth_token = TRELLO_OAUTH_TOKEN
config.oauth_token_secret = TRELLO_OAUTH_TOKEN_SECRET
end
```

3-legged OAuth authorization

```ruby
Trello.configure do |config|
config.consumer_key = TRELLO_CONSUMER_KEY
config.consumer_secret = TRELLO_CONSUMER_SECRET
config.return_url = "http://your.site.com/path/to/receive/post"
config.callback = lambda { |request_token| DB.save(request_token.key, request_token.secret) }
end
```

The current convention of setting `OAuthCredential.consumer_credential` etc. is still supported though I'd like to see it deprecated.

I believe this approach would make it easier to get up and running and may be a good solution to the ideas suggested previously https://trello.com/c/zmmvPD3k.