Question about API handling with Ruby


#1

Hey, I’m pretty inexperienced with Ruby, but I already got the basics and wrote my first own web application with Rails. The next thing I try to do is to get deeper into APIs.
I have already managed to crawl tweets with a certain content with the help of the twitter gem and would like to know how to proceed best.
My main goal is to write a plugin for Discourse that saves tweets using the Twitter API and then saves them to a Discourse Topic.

I’ve already managed to pull all the tweets, but now I’m struggling with the basics of Ruby and API handling.
A next step would be to make a post on my Discourse server using the Discourse API.
However, there seem to be still some basics missing. There are thousands of API clients for Ruby, do I need them? Are they useful for my purposes? (For example http gem)

What would be the next best step and are there good tutorials to learn that?
To display the tweets etc. there then and how and in which form, that is then a further step, first of all I would like to deal better with the API.

I would be very happy about help.


#2

Hi @Sepparated. Did you try asking on Discourse Meta? You plan sounds a bit like mirroring a mailing list, or feeding RSS to Discourse, so you may find existing examples of doing so. The logic would be the same, except you would:

  1. figure out whether the topic for the Twitter account already exists or not (to create it)
  2. post for every new tweet.

#3

yeah already asked there, sadly without a response.
I have a hard time to find a similar plugin which i could use as an example. I am wonndering cause it shouldnt be that hard to code, but i am pretty new to all the API stuff.


#4

I feel your pain. Started using the API not long ago, and still trying to wrap my mind around it.