Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Configurable client #42

Merged
merged 10 commits into from Jan 16, 2013

Conversation

Projects
None yet
2 participants
Collaborator

rossta commented Jan 16, 2013

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

Basic authorization

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

2-legged OAuth authorization

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

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.

Owner

jeremytregunna commented Jan 16, 2013

Can you update this pull request so that it'll merge cleanly? I'd love to merge this into the repo as soon as possible.

Collaborator

rossta commented Jan 16, 2013

Done. Thanks!

@jeremytregunna jeremytregunna added a commit that referenced this pull request Jan 16, 2013

@jeremytregunna jeremytregunna Merge pull request #42 from rossta/configurable_client
Configurable client
d7fb81f

@jeremytregunna jeremytregunna merged commit d7fb81f into jeremytregunna:master Jan 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment