简体   繁体   中英

Ruby on Rails Client API Implementation

I'm currently trying to implement the Coinbase API (as seen here: https://coinbase.com/api/doc ) on my Ruby on Rails application using Devise and Oauth2. I've gotten authentication to work just fine, however, I now need to be able to make requests to the API using the API I just linked. For example, I'd like to use 'GET /api/v1/account/balance' to show the account balance on the users profile page.

I've done extensive research on this issue, and haven't been able to find any explanations. I'm a bit of a newbie, so excuse me if this is a stupid question. If this information can be found elsewhere instead, could you provide a link?

Thank you in advance!

Try using the HTTparty gem for the HTTP requests.

Then in your controller once you have a valid auth_token for a user:

response = HTTParty.get("https://coinbase.com/api/v1/account/balance?access_token=#{auth_token}")

A quick google search lead to a gem released by the Coinbase team found at: Coinbase-ruby gem . It appears to implement all basic functions of their exposed API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM