ocrsdk 0.3.0 → 0.3.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -49,8 +49,12 @@ private
49
49
  profile: profile_to_s(profile))
50
50
  uri = URI.join @url, '/processImage', "?#{params}"
51
51
 
52
- RestClient.post uri.to_s, upload: { file: File.new(image_path, 'rb') }
53
- rescue RestClient::ExceptionWithResponse
54
- raise OCRSDK::NetworkError
52
+ retryable tries: OCRSDK.config.number_or_retries, on: OCRSDK::NetworkError, sleep: OCRSDK.config.retry_wait_time do
53
+ begin
54
+ RestClient.post uri.to_s, upload: { file: File.new(image_path, 'rb') }
55
+ rescue RestClient::ExceptionWithResponse
56
+ raise OCRSDK::NetworkError
57
+ end
58
+ end
55
59
  end
56
60
  end
@@ -6,6 +6,7 @@ describe OCRSDK::Image do
6
6
  OCRSDK.setup do |config|
7
7
  config.application_id = 'app_id'
8
8
  config.password = 'pass'
9
+ config.retry_wait_time = 0
9
10
  end
10
11
  OCRSDK::Mock.success
11
12
  end
@@ -68,9 +69,9 @@ describe OCRSDK::Image do
68
69
  }.to raise_error(OCRSDK::UnsupportedProfile)
69
70
  end
70
71
 
71
- it "should raise NetworkError on problems with REST request" do
72
+ it "should raise NetworkError on problems with REST request, retry 3 times before failing" do
72
73
  RestClient.stub(:post) {|url, params| raise RestClient::ExceptionWithResponse }
73
- RestClient.should_receive(:post).once
74
+ RestClient.should_receive(:post).exactly(3)
74
75
 
75
76
  expect {
76
77
  subject.instance_eval { api_process_image TestFiles.russian_jpg_path, [:russian] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocrsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: