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

twitter-compatible API: POST /statuses/update.json #571

Closed
carols10cents opened this issue Aug 17, 2012 · 9 comments
Closed

twitter-compatible API: POST /statuses/update.json #571

carols10cents opened this issue Aug 17, 2012 · 9 comments

Comments

@carols10cents
Copy link
Contributor

This is a smaller story broken out from #562.

This issue is just to make POST /statuses/update.json work like the twitter API. This route doesn't currently exist at all, but there is a nice update json decorator for you to use.

Ignore the issue of client authentication for the moment; just make this work as a normally authenticated user in the browser for now (see #564 about authentication)

https://dev.twitter.com/docs/api/1/post/statuses/update

Description: Updates the authenticating user's status, also known as tweeting.

Definitely interpret anything in the twitter docs so that it makes sense for rstat.us, and definitely ask if you have any questions!

Leave a comment if you're working on this.

@thomaslee
Copy link
Contributor

Happy to look at this one. What do you mean by a "nice update json decorator", though?

@thomaslee
Copy link
Contributor

Ah, found it -- never mind.

@thomaslee
Copy link
Contributor

Some early work here: thomaslee@3b8c355

WIP Branch: https://github.com/thomaslee/rstat.us/tree/twitter-api

It's not entirely clear to me if you feel we should be striving to match Twitter's API as closely as we can. I'm assuming so if we want to try & be compatible with existing clients?

Also, how do you feel about moving the API stuff into its own namespace as I've started doing on this branch? We could also try to lay this on top of our existing updates controller, but I think it may actually be cleaner to separate them out if we're going for compatibility with Twitter's API. Otherwise we'll introduce a whole lot of mess in UpdatesController extracting different input parameters depending which output format is selected (e.g. :text => params[:status] if params[:format] == "json", otherwise :text => params[:text] ... ?!).

I think if the shared logic could be crushed down a little further, the benefit of splitting the Twitter/JSON API into a separate (set of) controller(s) should be more readily apparent.

In any case, I think longer term it's going to be worth collaborating a common branch for all of this stuff. None of the twitter-compatible API tickets can really be addressed in a vacuum.

@steveklabnik
Copy link
Contributor

I'm assuming so if we want to try & be compatible with existing clients?

Yes, many Twitter clients let you change the endpoint. See #562 (comment)

@thomaslee
Copy link
Contributor

Yep, saw that. In that case, it's possible to play with the code on that branch with a POST /api/1/statuses/update.json & the obvious inputs per the Twitter spec. Still some cleanup to do, but you get the idea. Will look at that & test failures tomorrow, when it's not 4am. :)

@carols10cents
Copy link
Contributor Author

Yep, the real test for all of these is if it works with the existing clients.

I'm in favor of namespacing the twitter API routes-- since twitter has '1' in their base URL (blech), we should be able to add a namespace to the base URL.

I'll create a common branch for collaboration on dependent things, and that will probably be very useful for getting started and finishing, but I do think some of the API actions are independent of each other and could be merged to master before all of them are done.

@carols10cents
Copy link
Contributor Author

Ok I started a branch for combining work on this: https://github.com/hotsh/rstat.us/tree/twitter-api

I've got your commit on there, @thomaslee, and a commit of mine-- I'd like to see if we can avoid having versions in the url ;)

I'm working on some tests but haven't pushed that yet, I'm having trouble getting some old capybara session tricks working to stub out the authentication, so it's looking like I should get moving on that ;)

@thomaslee
Copy link
Contributor

Cheers Carol! Pushed an extra commit before I saw your email. Fixes the tests I broke. Afk for a bit if you'd like to merge it in, or I can do it later. :-)

@thomaslee
Copy link
Contributor

Opened a pull request for the change to address the failing tests in #587.

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

No branches or pull requests

3 participants