gini-api 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a949ae559fd91862b4eda06e33bd99d717e923c
4
- data.tar.gz: ef662694c99fd59112f90c6e0a2b35a316e5e858
3
+ metadata.gz: 9045dfe6c898a87b0c826c25105220e4f9456c7a
4
+ data.tar.gz: 6d602fd4cf03e9a79d479048477794dfcb8e8063
5
5
  SHA512:
6
- metadata.gz: 585493d99b5060412222a182df04d84a0613532826c5f2178380c061ffd943059ae76a74ea710bef0e42057d1c904039a95324b49f36b0af3cd87683f732d223
7
- data.tar.gz: 02360f6508c2d1df34ddae1d969c16924f29d26412ed5ff46bda906c539eb741a257c5a43dc907a2b1b0ac9f7922acd561ad87a0e6d12e5011e4b16073c87046
6
+ metadata.gz: 7a10e7a373e2253090c35b205ab6e5f32758ca93a4e6dbe47f1e18a32f1bd15ca3c5306abe77c3383342ba9ff5a7847185deca49c4825aaabc243b9d0ee7bee0
7
+ data.tar.gz: 731b1317a2b130db59aaa915c9bddd19b0c2f57521ac67b0c31fdef6c9b57fbf14c943fd09352794890805eb58ed4cf8cc9e1e75a3e8ac2b4698fa2952a73021
@@ -143,6 +143,7 @@ module Gini
143
143
  # Upload a document
144
144
  #
145
145
  # @param [String] file path of the document to upload
146
+ # @param [Float] interval Interval to poll progress
146
147
  #
147
148
  # @return [Gini::Api::Document] Return Gini::Api::Document object for uploaded document
148
149
  #
@@ -151,7 +152,7 @@ module Gini
151
152
  # @example Upload and monitor progress
152
153
  # doc = api.upload('/tmp/myfile.pdf') { |d| puts "Progress: #{d.progress}" }
153
154
  #
154
- def upload(file, &block)
155
+ def upload(file, interval = 0.5, &block)
155
156
  duration = Hash.new(0)
156
157
 
157
158
  # Document upload
@@ -160,7 +161,7 @@ module Gini
160
161
  # Start polling (0.5s) when document has been uploaded successfully
161
162
  if response.status == 201
162
163
  doc = Gini::Api::Document.new(self, response.headers['location'])
163
- duration[:processing] = poll_document(doc, &block)
164
+ duration[:processing] = poll_document(doc, interval, &block)
164
165
 
165
166
  duration[:total] = duration.values.inject(:+)
166
167
  doc.duration = duration
@@ -271,14 +272,15 @@ module Gini
271
272
  # Poll document and duration
272
273
  #
273
274
  # @param [Gini::Api::Document] doc Document instance to poll
275
+ # @param [Float] interval Polling interval for completion
274
276
  #
275
277
  # @return [Integer] Processing duration
276
278
  #
277
- def poll_document(doc, &block)
279
+ def poll_document(doc, interval, &block)
278
280
  duration = 0
279
281
  timeout(@processing_timeout) do
280
282
  duration = Benchmark.realtime do
281
- doc.poll(&block)
283
+ doc.poll(interval, &block)
282
284
  end
283
285
  end
284
286
  duration
@@ -57,7 +57,7 @@ module Gini
57
57
  #
58
58
  # @param [Float] interval API polling interval
59
59
  #
60
- def poll(interval = 0.5)
60
+ def poll(interval)
61
61
  EM.run do
62
62
  EM.add_periodic_timer(interval) do
63
63
  update
@@ -1,5 +1,5 @@
1
1
  module Gini
2
2
  module Api
3
- VERSION = "0.9.4"
3
+ VERSION = "0.9.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gini-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kerwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2