zenben1126
zenben1126

Reputation: 685

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!

Upvotes: 0

Views: 272

Answers (2)

cgcardona
cgcardona

Reputation: 121

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}")

Upvotes: 1

Zac Hallett
Zac Hallett

Reputation: 494

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.

Upvotes: 0

Related Questions