sachin-handiekar / jInstagram

A Java library for the Instagram API.
MIT License
385 stars 167 forks source link

Decouple requests and serialization from authentication and signing #177

Closed sigpwned closed 8 years ago

sigpwned commented 8 years ago

My team has started using a proxy for all API data collection for tracking purposes. The jInstagram proxy feature works great for that! However, we've taken the proxy one step further by having it handle authentication (by managing our access tokens) and signing, too. As a result, in order to keep using jInstagram, we need some way to send unauthenticated, unsigned requests to our proxy. That requires a couple of simple changes to tease apart the core API functionality -- basically HTTP requests and serialization -- from the authentication and signing code. In this pull request, I've moved the core functionality out of Instagram into a new abstract base class InstagramBase, leaving only the authentication and signing code in Instagram. The change is completely backwards compatible, but will allow my team to create an "unauthenticated" instagram client by subclassing InstagramBase.

Hopefully that description makes sense! Please shoot any questions my way!

Thanks for all your great work making an Instagram library that's so easy to use. :)

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-9.7%) to 57.763% when pulling a1e57fa1509555aaba5167d5eeacd9d751c988ea on sigpwned:master into 9dd479841addf836661d8acb523429974d029268 on sachin-handiekar:master.

sigpwned commented 8 years ago

Not sure why the test coverage has decreased so much. This change more or less only moves code around! :-/

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-9.7%) to 57.763% when pulling 32313abbeff211d8c9f53243203b7b2ef1360038 on sigpwned:master into 9dd479841addf836661d8acb523429974d029268 on sachin-handiekar:master.

sigpwned commented 8 years ago

I've made one additional change, which is to pull out an InstagramClient interface, which provides users a flexible way to pass around Instagram objects for doing work that will support any subclass of the unauthenticated InstagramBase, including the default Instagram object. Moving to an interface-based approach will also allow users to adopt some more sophisticated techniques, like dynamic proxies, so there are some other benefits, too!

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-9.7%) to 57.763% when pulling c3945b39629017524e99e94d8dddd7fd1fb3ff20 on sigpwned:master into 9dd479841addf836661d8acb523429974d029268 on sachin-handiekar:master.

sigpwned commented 8 years ago

Thank you so much for merging my pull request! Do you have the next jInstagram release planned? My team is anxious to integrate the changes from Maven Central! 😄

sachin-handiekar commented 8 years ago

I've released the library in maven central - https://mvnrepository.com/artifact/com.sachinhandiekar/jInstagram/1.1.8

sigpwned commented 8 years ago

Thank you!