Project

abbyy

0.01
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Abbyy Cloud OCR SDK API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
~> 0
~> 10.0
~> 3.0

Runtime

>= 1.8.0
 Project Readme

abbyy

Simple Ruby wrapper for Abbyy Cloud OCR SDK

Build Status Gem

Installation

Add this line to your application's Gemfile:

gem 'abbyy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install abbyy

Example

client = Abbyy::Client.new(APPLICATION_ID, PASSWORD)
client.process_business_card "business_card.png", exportFormat: 'xml', imageSource: 'photo'
client.get_task_status
client.get

Example with Ruby on Rails

$ touch config/initializers/abbyy.rb
require 'abbyy'

Abbyy.configure do |config|
  config.application_id = APPLICATION_ID
  config.password = PASSWORD
end

Everywhere in your rails application, you can access Abbyy without crendentials:

client = Abbyy::Client.new
client.process_image "image.png"

Example with Resque

Create new worker ImageScanner:

$ touch app/workers/image_scanner.rb
class ImageScanner
  @queue = :scanner

  def self.perform(attachment_id)
    attachment = Attachment.find_by_id(attachment_id)
    client = Abbyy::Client.new
    client.process_business_card attachment.full_filename, exportFormat: 'xml', imageSource: 'photo'
    while %w(Queued InProgress).include?(client.task[:status])
      sleep(client.task[:estimatedProcessingTime].to_i)
      client.get_task_status
    end
    if client.task[:status] == 'Completed'
      xml_data = REXML::Document.new(client.get)
      ...
    else
      ...
    end
  end
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

  1. Fork it ( https://github.com/madwork/abbyy/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request