whichdigital / active-rest-client

ActiveRestClient API Client
https://rubygems.org/gems/active_rest_client
MIT License
386 stars 44 forks source link

Add request signing through Api-Auth gem #84

Closed nathanhoel closed 9 years ago

nathanhoel commented 9 years ago

Api-Auth is a popular gem for signing and authorizing requests. ActiveResource an alternative Ruby rest client offers an integration with ApiAuth and it probably the only thing that it offers that ActiveRestClient does not.

Here is an excerpt from the changes I am making to the docs (gives an example of how to configure)

Using the Api-Auth integration it is very easy to sign requests. Simply configure Api-Auth one time in your app and all requests will be signed from then on.

@access_id = '123456'
@secret_key = 'abcdef'
ActiveRestClient::Base.api_auth_credentials(@access_id, @secret_key)

Also if we are able to have this merged I can definitely submit a pull request to Api-Auth to have ActiveRestClient added to their documentation as a support integration.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.02%) to 99.19% when pulling 26720ef3a51bd113af98ab68296eac05f06d93b7 on nathanhoel:master into 06b2840e2e0e1feafb95ebcff278a01ac1985f2d on whichdigital:master.

andyjeffries commented 9 years ago

Good one, merged. Thanks.

kjg commented 9 years ago

I think it's great that you added api-auth support. I feel bad, though, that this will force all users of active-rest-client to depend on the api-auth gem even if they aren't using the feature.

Do you think it might be worth it to require users to add api-auth to their gemfile themselves? I think this could be achieved by only requiring api-auth if the api_auth_credentials method is called, and then maybe giving a nice error message about how to add api-auth if a load error is raised.

nathanhoel commented 9 years ago

That's a great idea. I will add that tomorrow I bet Andy will appreciate that suggestion too.

andyjeffries commented 9 years ago

See Nathan, you already understand me. Absolutely, I think it's a great idea.

In the past we've forced gems that a lot of people may not want, but we've tend to take the point of making it easy to use rather than lower dependencies.

@nathanhoel if you can work on making it an optional requirement, that would be great.

@kjg thanks for the comment.