├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Procfile ├── README.md ├── app.json ├── app.rb ├── public └── favicon.png └── views ├── about.erb ├── index.erb ├── layout.erb └── search.erb /.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-2.1.3 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | ruby '2.1.3' 2 | source 'https://rubygems.org' 3 | 4 | gem 'sinatra' 5 | gem 'sinatra-flash' 6 | gem 'json' 7 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | json (1.8.1) 5 | rack (1.6.0) 6 | rack-protection (1.5.3) 7 | rack 8 | sinatra (1.4.5) 9 | rack (~> 1.4) 10 | rack-protection (~> 1.4) 11 | tilt (~> 1.3, >= 1.3.4) 12 | sinatra-flash (0.3.0) 13 | sinatra (>= 1.0.0) 14 | tilt (1.4.1) 15 | 16 | PLATFORMS 17 | ruby 18 | 19 | DEPENDENCIES 20 | json 21 | sinatra 22 | sinatra-flash 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Quiztionary 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: ruby app.rb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | quiztionary 2 | =========== 3 | 4 | Crowdsourced dictionary powered by [Quizlet](https://quizlet.com) 5 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Quiztionary", 3 | "description": "crowdsourced dictionary powered by quizlet", 4 | "keywords": ["ruby", "sinatra", "sequel", "dictionary", "quizlet"], 5 | 6 | "website": "http://quiztionary.herokuapp.com", 7 | "repository": "https://github.com/quiztionary/backend", 8 | 9 | "env": { 10 | "KEY": { 11 | "description": "Quizlet client API key", 12 | "required": true 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app.rb: -------------------------------------------------------------------------------- 1 | # require necessary gems 2 | require 'sinatra' 3 | require 'json' 4 | require 'pry' if Sinatra::Base.development? 5 | require 'bundler' 6 | 7 | # ensure gem bundling 8 | Bundler.require 9 | 10 | # search quizlet sets for word's definition 11 | def get_entries(word) 12 | uri = URI("https://api.quizlet.com/2.0/search/definitions") 13 | params = { :client_id => ENV['KEY'], :q => word } 14 | uri.query = URI.encode_www_form(params) 15 | JSON.parse(Net::HTTP.get_response(uri).body)['official_definitions'] 16 | end 17 | 18 | # display homepage 19 | get '/' do 20 | erb :index 21 | end 22 | 23 | get '/about' do 24 | erb :about 25 | end 26 | 27 | # parse and display results from search 28 | get '/search' do 29 | word = params[:q] 30 | @results = get_entries word 31 | erb :search 32 | end 33 | -------------------------------------------------------------------------------- /public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tejasmanohar/quiztionary/bbee33fd49d08e8191372eb08a51580ecb953282/public/favicon.png -------------------------------------------------------------------------------- /views/about.erb: -------------------------------------------------------------------------------- 1 |
Quiztionary is an open-source, crowdsourced Quizlet-powered dictionary developed by Tejas Manohar.
If you would like to contribute, please open a pull request on Github.