skip to Main Content

I am new to ruby want to create an api which post tweet to twitter without help of any gem include as we did on command line by running below code:

curl --request 'POST' 'https://api.twitter.com/1.1/statuses/update.json' --data 'status=Maybe+he%27ll+finally+find+his+keys.+%23peterfalk' --header 'Authorization: OAuth oauth_consumer_key="i6baQCTt1sCXAo8YWcKhuly9Z", oauth_nonce="12f94f3e4b2ded3bbfdfe781de60ae73", oauth_signature="x6%2Fi2w%2F0RjN4prcFmA5HthOZU3Q%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1461568353", oauth_token="2291131736-LpQkfe5diMTung5mVQ0Dc5EKA9u8qnIgWuPqau9", oauth_version="1.0"' --verbose

But in controller how can we use this command so it get ouath_signature and post the tweet.

As In php it did with curl want same way ion ruby.

Please help me to get out of it

2

Answers


  1. You may use rest-client to make your api calls.
    Or if you really don’t even want to use that gem also.

    Try this : http://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTP.html

    which comes with the ruby standard library

    Login or Signup to reply.
  2. If I understand correctly, you can use:

    http://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTP.html
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search