emmy-http 0.2.13 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/emmy-http.gemspec +1 -1
- data/lib/emmy_http/{timeout.rb → timer.rb} +12 -1
- data/lib/emmy_http/version.rb +1 -1
- data/spec/emmy_http_spec.rb +5 -5
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 245c9aadcae6350e5530b83c2b7c4ea26dff32e7
|
4
|
+
data.tar.gz: 64e9aff22e55d02c30098299694b32105121b2e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d7c309b72471cba3708b5c5a7e607d6844fdd0cc1d6a51cad68cbfeb359780e93467b11aa03d21967b8d147b953d1d9fecab32d3f84b874db66603b06b95ea2
|
7
|
+
data.tar.gz: 9332f4ce846ef1270d87423850d22371cf66ea41d0951243d0e87383aa13fb9fe7ac439d6cf80cfb20694c73cb7321c5c9c105d4daffb95643601a2029cd46ce
|
data/README.md
CHANGED
data/emmy-http.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_dependency "event_object", "~> 0.9"
|
28
|
-
spec.add_dependency "emmy-machine", "~> 0.
|
28
|
+
spec.add_dependency "emmy-machine", "~> 0.2"
|
29
29
|
spec.add_dependency "fibre", "~> 0.9"
|
30
30
|
spec.add_dependency "util_pack", "~> 0.1"
|
31
31
|
spec.add_dependency "model_pack", "~> 0.9"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module EmmyHttp
|
2
|
-
class
|
2
|
+
class Timer
|
3
3
|
using EventObject
|
4
4
|
attr_accessor :interval
|
5
5
|
|
@@ -26,6 +26,17 @@ module EmmyHttp
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def await
|
30
|
+
Fiber.await do |fiber|
|
31
|
+
# create connection
|
32
|
+
start
|
33
|
+
|
34
|
+
on :timeout do
|
35
|
+
fiber.resume true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
29
40
|
#<<<
|
30
41
|
end
|
31
42
|
end
|
data/lib/emmy_http/version.rb
CHANGED
data/spec/emmy_http_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe EmmyHttp do
|
|
14
14
|
EmmyMachine.run_block &example
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "should send HTTP-request with the fake adapter" do
|
18
18
|
request = EmmyHttp::Request.new(
|
19
19
|
type: 'get',
|
20
20
|
url: 'http://google.com'
|
@@ -27,7 +27,7 @@ describe EmmyHttp do
|
|
27
27
|
expect(response.body).to eq "OK"
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "should send HTTP-request using the short syntax" do
|
31
31
|
response = request(adapter: FakeAdapter, raise_error: false).get('http://google.com').sync
|
32
32
|
|
33
33
|
expect(response).to_not be nil
|
@@ -36,7 +36,7 @@ describe EmmyHttp do
|
|
36
36
|
expect(response.body).to eq "OK"
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "should send several requests in parallel" do
|
40
40
|
req = request(adapter: FakeAdapter, raise_error: false)
|
41
41
|
responses = {
|
42
42
|
a: [req.copy.get('http://google.com'), req.copy.get('http://google.com')],
|
@@ -48,14 +48,14 @@ describe EmmyHttp do
|
|
48
48
|
expect(responses[:b].status).to be 200
|
49
49
|
end
|
50
50
|
|
51
|
-
it "should
|
51
|
+
it "should be waiting couple seconds" do
|
52
52
|
timeout = EmmyHttp::Timeout.new(2)
|
53
53
|
res = timeout.sync
|
54
54
|
|
55
55
|
expect(res).to be true
|
56
56
|
end
|
57
57
|
|
58
|
-
it "should
|
58
|
+
it "should pack settings of the request in the Hash/Array structure" do
|
59
59
|
request = EmmyHttp::Request.new(
|
60
60
|
type: 'get',
|
61
61
|
url: 'http://google.com'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: event_object
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: fibre
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +173,7 @@ files:
|
|
173
173
|
- lib/emmy_http/response.rb
|
174
174
|
- lib/emmy_http/server/application.rb
|
175
175
|
- lib/emmy_http/server/configuration.rb
|
176
|
-
- lib/emmy_http/
|
176
|
+
- lib/emmy_http/timer.rb
|
177
177
|
- lib/emmy_http/utils.rb
|
178
178
|
- lib/emmy_http/version.rb
|
179
179
|
- spec/emmy_http/model_spec.rb
|
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
204
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.
|
205
|
+
rubygems_version: 2.5.1
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: EmmyHttp - EventMachine's HTTP Client
|
@@ -213,3 +213,4 @@ test_files:
|
|
213
213
|
- spec/emmy_http_spec.rb
|
214
214
|
- spec/fakes.rb
|
215
215
|
- spec/spec_helper.rb
|
216
|
+
has_rdoc:
|