smart_polling 0.0.2 → 1.0.0

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: 13d030532c95a22fea292dc26f2ce9bca268af3f
4
- data.tar.gz: 089fc646bc0c4763b70f24481f770b3d3bb3a86f
3
+ metadata.gz: 15a233d2c98ca46c95e4554a0d1c57e3220d8e3e
4
+ data.tar.gz: 06811073887522d2b729aebe2e8fcf42a75dd890
5
5
  SHA512:
6
- metadata.gz: 9390b2f2bb12981600a67676ed519d4afe0373f00bd1a996c2b46ec983120a2a71deb2111fb99c42a975bec5fd3bce62e9ab76d1fce40d3f686173505472e615
7
- data.tar.gz: 4ca56eaf7b541f467c2fd703e4b8e749441cc4a6ed46fb37429f51a29a5c190e95ee4063755c4e5020e9a9a51801514c82420d2d6396d6c70f4fa7c9cf8d257e
6
+ metadata.gz: b9aa74881fe2720d02f0fd5e35da30211abbe693d18b62c81943a05750085f6854e8c485d27eb7feb47c6c69d916a19bee13bac60bf9246bc1d959cf3d2831a8
7
+ data.tar.gz: df63e3134a505f60841d2724845daa7a76d001f294f2bf67ff0787ec7c925f70245d242dfe6cb4ce9a89fc015e3420168ebaa9d8a5e4333f775fbbdb7bd11924
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.3.0
@@ -1,10 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
- - 1.9.3
5
3
  - 2.0.0
6
4
  - "2.1"
7
5
  - "2.2"
6
+ - "2.3"
8
7
  - ruby-head
9
- - jruby-19mode
10
8
  - jruby-head
@@ -0,0 +1,16 @@
1
+ # Smart Polling ChangeLog
2
+
3
+ ## 1.0.0
4
+
5
+ * **Breaking change:** Rename `seconds` parameter to `timeout`
6
+ * **Breaking change:** Rename `delay` parameter to `interval`
7
+ * Add CHANGELOG file
8
+
9
+ ## 0.0.2
10
+
11
+ * Better package description
12
+ * Add README
13
+
14
+ ## 0.0.1
15
+
16
+ * Initial Version
data/README.md CHANGED
@@ -25,7 +25,7 @@ Or install it yourself as:
25
25
  It will call the external service until the response is "done":
26
26
 
27
27
  ```ruby
28
- SmartPolling.poll(seconds: 60, delay: 5) do
28
+ SmartPolling.poll(timeout: 60, interval: 5) do
29
29
  response = ExternalService.call
30
30
  response == "done"
31
31
  end
@@ -3,14 +3,14 @@ require "smart_polling/version"
3
3
  class SmartPolling
4
4
  class TimeoutError < StandardError; end
5
5
 
6
- def self.poll(seconds: 10, delay: 1, timeout_error: nil)
6
+ def self.poll(timeout: 10, interval: 1, timeout_error: nil)
7
7
  timeout_error ||= TimeoutError.new
8
- time_limit = Time.now + seconds
8
+ time_limit = Time.now + timeout
9
9
 
10
10
  while Time.now < time_limit do
11
11
  result = yield
12
12
  return result if result
13
- sleep delay
13
+ sleep interval
14
14
  end
15
15
 
16
16
  raise timeout_error
@@ -1,3 +1,3 @@
1
1
  class SmartPolling
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -6,12 +6,12 @@ RSpec.describe SmartPolling do
6
6
  let(:block) { -> { false } }
7
7
 
8
8
  it "raises SmartPolling::TimeoutError" do
9
- expect { SmartPolling.poll(seconds: 0.2, delay: 0.05, &block) }.
9
+ expect { SmartPolling.poll(timeout: 0.2, interval: 0.05, &block) }.
10
10
  to raise_error(SmartPolling::TimeoutError)
11
11
  end
12
12
 
13
13
  it "raises a custom error" do
14
- expect { SmartPolling.poll(seconds: 0.2, delay: 0.05, timeout_error: StandardError.new("custom_error"), &block) }.
14
+ expect { SmartPolling.poll(timeout: 0.2, interval: 0.05, timeout_error: StandardError.new("custom_error"), &block) }.
15
15
  to raise_error(StandardError, "custom_error")
16
16
  end
17
17
  end
@@ -23,7 +23,7 @@ RSpec.describe SmartPolling do
23
23
  end
24
24
 
25
25
  it "returns the first non-false value" do
26
- expect(SmartPolling.poll(seconds: 0.2, delay: 0.05, &block)).to eq("return_value")
26
+ expect(SmartPolling.poll(timeout: 0.2, interval: 0.05, &block)).to eq("return_value")
27
27
  end
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ RSpec.describe SmartPolling do
31
31
  let(:block) { -> { "return_value" } }
32
32
 
33
33
  it "returns the value" do
34
- expect(SmartPolling.poll(seconds: 0.2, delay: 0.05, &block)).to eq("return_value")
34
+ expect(SmartPolling.poll(timeout: 0.2, interval: 0.05, &block)).to eq("return_value")
35
35
  end
36
36
  end
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_polling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateus Del Bianco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-24 00:00:00.000000000 Z
11
+ date: 2016-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,7 @@ files:
65
65
  - ".ruby-gemset"
66
66
  - ".ruby-version"
67
67
  - ".travis.yml"
68
+ - CHANGELOG.md
68
69
  - Gemfile
69
70
  - LICENSE.txt
70
71
  - README.md
@@ -94,11 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  requirements: []
96
97
  rubyforge_project:
97
- rubygems_version: 2.4.8
98
+ rubygems_version: 2.5.1
98
99
  signing_key:
99
100
  specification_version: 4
100
101
  summary: SmartPolling is the smartest way to poll something.
101
102
  test_files:
102
103
  - spec/smart_polling_spec.rb
103
104
  - spec/spec_helper.rb
104
- has_rdoc: