Sha256: a8087cc9ebb434e00d5fa15935971edb173bc029172dc28a6c061704dc1a247e

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

require 'httparty'

module OcrSpace
    class Url
        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(ocr_space,
                                  body: { apikey: apikey,
                                          language: language,
                                          isOverlayRequired: isOverlayRequired,
                                          url: url })
            @data = @data.parsed_response['ParsedResults']
        end

        def text_data
            data[0]['ParsedText'].delete("\n").delete("\r").strip
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ocr_space-1.0 lib/ocr_space/from_url.rb