Sha256: f997e2cfe2393889ca7d949191da43a13c4646ef0a8b9c4fb2438313db12ff87

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

require 'httparty'

module OcrSpace
    class FromUrl
        attr_reader :data
        def initialize(apikey: ENV['ocr_api_key'], language: 'eng', isOverlayRequired: false, url: nil, ocr_space: 'https://api.ocr.space/parse/image')
            @data = HTTParty.post('https://api.ocr.space/parse/image',
                                  body: { apikey: apikey,
                                          language: language,
                                          isOverlayRequired: isOverlayRequired,
                                          url: url })
        end

        def text_data
            data.parsed_response['ParsedResults'][0]['ParsedText']
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ocr_space-0.2.7.3 lib/ocr_space/from_url.rb
ocr_space-0.2.7.2 lib/ocr_space/from_url.rb
ocr_space-0.2.7.1 lib/ocr_space/from_url.rb