Skip to content

Instantly share code, notes, and snippets.

@rubenfonseca
Created January 28, 2011 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenfonseca/800841 to your computer and use it in GitHub Desktop.
Save rubenfonseca/800841 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'oauth'
require 'json'
consumer = OAuth::Consumer.new 'ds1UTK4sT3R5MVhYIYV6w', 'RtqyirueGdzUt0tpbuuYnZAxUv71E3xrxxpfnkxt4', { :site => 'http://hireme.goplanapp.com' }
req = consumer.get_request_token
puts req.authorize_url
sleep 20
access = req.get_access_token
puts access.get('/api/projects/get_all?format=json').body
data = JSON.parse(access.get('/hireme/api/documents/get_token?format=json').body)
puts data['token']
token = data['token']
data = JSON.parse(access.get('/hireme/api/users/about_me?format=json').body)
puts data['user']['id']
user_id = data['user']['id']
puts access.post('/hireme/api/documents/create?format=json', {
'file[title]' => 'testing',
'file[uploaded_data]' => IO.read('/etc/hosts'),
'token' => token,
'user' => user_id
}).body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment