Project

cloudsight

0.02
Low commit activity in last 3 years
No release in over a year
A simple CloudSight API Client for Image Recognition
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 2.0
~> 0.10
~> 12.0
~> 3.6
~> 3.0

Runtime

~> 2.1
 Project Readme

cloudsight-ruby

A simple CloudSight API Client

Project Gem Release
gem name cloudsight
version Gem Version
continuous integration Build Status

Installation

$ gem install cloudsight

Install the simple_oauth gem to use with oauth options.

$ gem install simple_oauth

Configuration

require 'rubygems'
require 'simple_oauth'
require 'cloudsight'

Cloudsight.oauth_options = {
  consumer_key: 'REPLACE WITH YOUR KEY',
  consumer_secret: 'REPLACE WITH YOUR SECRET'
}

or, using a single API key:

require 'rubygems'
require 'cloudsight'

Cloudsight.api_key = 'REPLACE WITH YOUR KEY'

Usage

Send the image request using a file:

request_data = Cloudsight::Request.send(locale: 'en', file: File.open('image.jpg'))

Or, you can send the image request using a URL:

request_data = Cloudsight::Request.send(locale: 'en', url: 'http://www.google.com/images/srpr/logo11w.png')

Then, use the token to retrieve the response:

response_data = Cloudsight::Response.get(request_data['token'])

You can also use the retrieve method which will poll for the response for you:

Cloudsight::Response.retrieve(request_data['token']) do |response_data|
  p response_data
end