Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gcs_api_gem

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcs_api_gem

  • 0.4.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

GcsApiGem

This project is a Ruby lib for Google's Custom Search Engine API (http://www.google.com/cse). This is very easy to use but available functions are restricted.

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/gcs_api_gem. To experiment with that code, run bin/console for an interactive prompt.

Installation

Add this line to your application's Gemfile:

gem 'gcs_api_gem'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gcs_api_gem

Configure

You need to configure KEY and CSE_ID to environment variables.

$ export KEY=<GOOGLE_API_KEY>
$ export SCE_ID=<GOOGLE_CUSTOM_SEARCH_ENGINE_ID>

Or write to .bashrc as below:

export KEY=<GOOGLE_API_KEY>
export SCE_ID=<GOOGLE_CUSTOM_SEARCH_ENGINE_ID>

And then execute:

$ source ~/.bashrc

Remarks

If you want to know how to get GOOGLE_CUSTOME_SEARCH_ENGINE_ID and GOOGLE_API_KEY, look at here. Or see here.

Usage

In a program

Write in your program as below:

obj.GcsApiGem::SearchApi.new
obj.random_image(<keyword>)

Then you get a random image searched by keyword.

Example
> obj = GcsApiGem::SearchApi.new
> obj.random_image('cat')
=> {
    :keyword=>"cat",
    :title=>"Cute Cat - Chrome Web Store",
    :image=>"https://lh3.googleusercontent.com/FnN1_Jabl5WITJrHYLGv80r-GNSNAPI_nwrrSgHh8fRUh5fsHFMmPFkPOjaX16H5Pi-Fwotg=w640-h400-e365",
    :search_result=>"320000000",
    :start_index=>2
   }
Response

Response of GcsApiGem::SearchApi#random_image is as below:

keydetail
keywordIt is using keyword to search image.
titleThe title of the web site that got the image.
imageThe URL of the got image.
search_resultNumber of images hit in search.
start_indexNumber of page on which the image is displayed.

In a command line

Write in a command line as below:

$ gcs_api_gem -r cat

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tashua314/gcs_api_gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the GcsApiGem project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct

FAQs

Package last updated on 16 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc