google_search_cse

A Ruby library to integrate Google Custom Search Engine (CSE) into Rails applications. Lets you add Google-powered search to your site using your own custom search engine ID.

Installation

Add this line to your Gemfile:

gem 'google_search_cse'

Then run:

bundle install

Setup

  1. Create a Custom Search Engine at programmablesearchengine.google.com
  2. Note your Search Engine ID (cx)
  3. Enable the Custom Search JSON API in Google Cloud Console and grab an API key

Usage

search = GoogleSearchCse.new
results = search.query("YOUR_API_KEY", "YOUR_CX_ID", "ruby on rails")