Reputation: 5644
I am trying to access the Soundcloud API in a local .rb file on my computer.
This is the code I would use in a Ruby on Rails app:
require 'soundcloud'
# create a client object with your app credentials
client = Soundcloud.new(:client_id => 'MY_CLIENT_ID')
# find all sounds of buskers licensed under 'creative commons share alike'
tracks = client.get('/tracks', :q => 'buskers', :licence => 'cc-by-sa')
How can i rewrite this to work in a local .rb file on my computer (not in a ruby on rails app)?
Upvotes: 0
Views: 191
Reputation: 34
I would create a Gemfile in the same directory you're making the .rb file that would utilize the Soundcloud API wrapper gem, then specify the gem in there. Using Bundler it should detect the gem on your machine and utilize it locally.
Upvotes: 2