Skip to content

Instantly share code, notes, and snippets.

@woto
Created December 29, 2015 09:30
Show Gist options
  • Save woto/ee173d60b9fbc730cd2d to your computer and use it in GitHub Desktop.
Save woto/ee173d60b9fbc730cd2d to your computer and use it in GitHub Desktop.
Sound Cloud Upwork Example
require 'soundcloud'
# create client object with app and user credentials
client = Soundcloud.new(:client_id => '9d4172e33cae2f8b20ef5603e494bc1d',
:client_secret => 'bee1d79bb85a00f4ccc2cefe1377d737',
:username => '[email protected]',
:password => 'Qwer3322!')
puts client
# upload an audio file
track = client.post('/tracks', :track => {
:title => 'This is my sound',
:asset_data => File.new('file.mp3', 'rb')
})
# print track link
puts track.permalink_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment