Skip to content

Instantly share code, notes, and snippets.

@tejo
Created April 23, 2015 19:07
Show Gist options
  • Save tejo/29caf630905f8a05763d to your computer and use it in GitHub Desktop.
Save tejo/29caf630905f8a05763d to your computer and use it in GitHub Desktop.
source 'https://rubygems.org'
gem 'sinatra'
gem 'thingiverse'
gem 'pry'
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.0)
curb (0.8.8)
httparty (0.13.3)
json (~> 1.8)
multi_xml (>= 0.5.2)
json (1.8.2)
method_source (0.8.2)
multi_xml (0.5.5)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.0)
rack-protection (1.5.3)
rack
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0)
thingiverse (0.0.7)
curb
httparty
json
tilt (2.0.1)
PLATFORMS
ruby
DEPENDENCIES
pry
sinatra
thingiverse
require 'rubygems'
require 'bundler/setup'
require 'sinatra'
require 'pry'
require 'thingiverse'
require "net/http"
client_id = ""
client_secret = ""
get "/auth" do
redirect("https://www.thingiverse.com/login/oauth/authorize?client_id=#{client_id}&redirect_uri=http://localhost:3000/callback")
end
get "/callback" do
tv = Thingiverse::Connection.new(client_id, client_secret, params[:code])
uri = URI("https://api.thingiverse.com/search/quadcopter/?access_token=#{tv.access_token}")
body = Net::HTTP.get(uri)
res = JSON.parse(body)
res.inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment