项目作者: emmpak

项目描述 :
Web application which utilizes Google Custom Search API
高级语言: Ruby
项目地址: git://github.com/emmpak/feel_lucky.git
创建时间: 2017-06-21T07:43:42Z
项目社区:https://github.com/emmpak/feel_lucky

开源协议:

下载


Feel Lucky

Build Status
Coverage Status

Are you feeling lucky today? Pick a color and let your imagination run wild.

Tech

  • Ruby, Sinatra, PostgrSQL, DataMapper, HTML, CSS, JavaScript RSpec, Capybara

Live Version

Feel Lucky

Note that the Google Custom Search API key has a very low call threshold and you might not find yourself lucky. As an alternative, you can setup this app locally (see next section).

Local Setup

Initial Steps
  • Clone repository
  • cd to the project’s root directory
  • Run gem install bundler
  • Run bundle install to install all of the required gems
  • Create the following databases feel_lucky_development and feel_lucky_test
Register for a Google Custom Search API key

Go to Custom Search API and click on ‘Get a Key’ button under the prerequisites section. Make a note of your API Key as you will need it later.

Create your Google Custom Search Engine

Go to Custom Search Engine and click on Add to create your own custom search engine. You can select ‘Search the entire web but emphasise included sites’ from the Sites to Search section if you would like to search any Google images. Make a note of your Search engine ID.

Setup your environment variables

In your root directory, create a .env file and add the following:

  1. API_KEY = YOUR API KEY
  2. CX_ID = YOUR SEARCH ENGINE ID
Final Steps
  • Run rspec to make sure that all tests are passing
  • Uncomment the API response on line 26 in the app.rb file and remove the stubbed response on line 29. You can use the stubbed response to avoid hitting the API call limit.
  • Run rackup
  • Visit localhost:9292 in a browser
  • Pick a color

Further Improvements

  • Add a Search again button on /search page
  • Ability to run previous searches