Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject credentials #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

igneus
Copy link

@igneus igneus commented Jun 24, 2015

I don't like the fact that credentials may only be provided using a configuration file in the home directory. As a solution I suggest inversion of control when dealing with credentials - the Service should not know where to ask for them, but expect them as provided on initialization. That makes it possible to supply them like

ShortURL.shorten 'http://oh.my/very/long/url', :bitly, {'username' => 'joe', 'key' => 'key123'}

The code in the PR is just a quick proposal for now. If it was to be accepted, I would also provide tests that are now missing.

the 'include_context' method, used in several specs,
isn't available before 2.6
Don't force the user to depend solely on a
configuration file in the home directory.
Now credentials may be supplied directly when calling
ShortURL.shorten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant