Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

drync/cloudsight-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloudsight-ruby

A simple CloudSight API Client

Project Gem Release
gem name gem-release
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:

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

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

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

Then, use the token to retrieve the response:

responseData = Cloudsight::Response.get(requestData['token'])

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

Cloudsight::Response.retrieve(requestData['token']) do |responseData|
  p responseData
end

About

CloudSight API Client for Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%