abbyy 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ace1c914a60d684baeafc6b07b42845c6667c8f
4
- data.tar.gz: de357e43d7e14a8dab0d9c2f1a3eba3c43fd74c5
3
+ metadata.gz: 334edb58265582d7dcb1ded99972284ce6d82932
4
+ data.tar.gz: b53be5b91c81193c3ba53a0cbcc7fdb13f9f2d44
5
5
  SHA512:
6
- metadata.gz: db15fdb3e899501ec0b662d2491555e72ea5a36387e4230446c9e608e9a5df37b1ecee845439dadffde7a1bc45d28e02e50a4a11bdccdc94f44f18fce7cb9953
7
- data.tar.gz: af015b8457a2635ff1229932fdc0b04ebd6be753fce06a82744e9eca507756ab7d28544fa9c504e1d65d3cdf26ca184aff58f238577b80b8e52976a7a42ca999
6
+ metadata.gz: bea78c7cebeb031c421db2a1fd757b368b68e69bd9ca6f9457141b891c58d10166354030578820225fbed62249efef7a0b3402a0c49d57daa9b48fc235485b89
7
+ data.tar.gz: dca89277bf174cad5651f594ee8ba13866f89d9cf9042e99e5a1f6033d7ca87bc64d533be90174cdd9c8309c93258869142e701420908e4ac05d863566382537
data/Guardfile CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  guard :rspec, cmd: 'rspec' do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
7
  watch('spec/spec_helper.rb') { "spec" }
8
8
  end
data/README.md CHANGED
@@ -32,9 +32,7 @@ client.get
32
32
 
33
33
  ### Example with Ruby on Rails
34
34
 
35
- ```shell
36
- touch config/initializers/abbyy.rb
37
- ```
35
+ $ touch config/initializers/abbyy.rb
38
36
 
39
37
  ```ruby
40
38
  require 'abbyy'
@@ -56,9 +54,7 @@ client.process_image "image.png"
56
54
 
57
55
  Create new worker ImageScanner:
58
56
 
59
- ```shell
60
- touch app/workers/image_scanner.rb
61
- ```
57
+ $ touch app/workers/image_scanner.rb
62
58
 
63
59
  ```ruby
64
60
  class ImageScanner
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
- require "bundler/gem_tasks"
1
+ require 'rspec/core/rake_task'
2
+ require 'bundler/gem_tasks'
3
+
4
+ # Default directory to look in is `/specs`
5
+ # Run with `rake spec`
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = ['--color', '--format', 'progress']
8
+ end
9
+
10
+ task :default => :spec
@@ -7,15 +7,26 @@ module Abbyy
7
7
  include Abbyy::XML
8
8
  include Abbyy::Task
9
9
 
10
- attr_reader :task, :url
10
+ API_ENDPOINT = "cloud.ocrsdk.com"
11
+
12
+ attr_reader :task
11
13
 
12
14
  def initialize(application_id = Abbyy.application_id, password = Abbyy.password)
13
15
  @appliction_id = application_id
14
16
  @password = password
15
- @url = "http://#{CGI.escape(@appliction_id)}:#{CGI.escape(@password)}@cloud.ocrsdk.com"
16
17
  @task = {}
17
18
  end
18
19
 
20
+ # @return [String] the api url with credentials
21
+ def url
22
+ @url ||= begin
23
+ uri = URI::HTTP.build host: API_ENDPOINT
24
+ uri.user = CGI.escape @appliction_id.to_s
25
+ uri.password = CGI.escape @password.to_s if uri.user
26
+ uri.to_s
27
+ end
28
+ end
29
+
19
30
  alias_method :current_task, :task
20
31
 
21
32
  # Retrieve the result of processing task
@@ -2,6 +2,8 @@ require 'abbyy/inflector'
2
2
 
3
3
  module Abbyy
4
4
  module Task
5
+ include Inflector
6
+
5
7
  @@attributes = %w(id status result_url registration_time error description estimated_processing_time credits files_count status_change_time)
6
8
 
7
9
  @@attributes.each do |attribute|
@@ -1,3 +1,3 @@
1
1
  module Abbyy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abbyy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Durand
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler