emmy-http 0.3.0 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/emmy-http.gemspec +9 -9
- data/lib/emmy_http.rb +1 -1
- data/lib/emmy_http/model.rb +2 -2
- data/lib/emmy_http/operation.rb +2 -2
- data/lib/emmy_http/request.rb +2 -2
- data/lib/emmy_http/timer.rb +0 -11
- data/lib/emmy_http/version.rb +1 -1
- data/spec/emmy_http/model_spec.rb +3 -3
- data/spec/emmy_http/response_spec.rb +1 -1
- data/spec/emmy_http_spec.rb +11 -11
- metadata +17 -20
- data/spec/emmy_http/request_spec.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3db217642cc4a19a04b9171fdf5e592a5f67d1e
|
4
|
+
data.tar.gz: dd2065202e52783ca08c454984fcedef72ddecaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9548c80f5424446956fa75bcac344e75821f2511c3d8eb9c0ec5c223afd12317ed98d475f35f143f689048627627dbfee1c640827fed49309bdd223d83dbe2cf
|
7
|
+
data.tar.gz: 1a96f6c314de4fd25bd99add9b188b459c1e1b4394db74298194234b441094f880f413d8c243ea553990b80bec2bb1d38a5bbae3ed54e357ed9ff889252f6312
|
data/emmy-http.gemspec
CHANGED
@@ -12,10 +12,10 @@ end
|
|
12
12
|
Gem::Specification.new do |spec|
|
13
13
|
spec.name = "emmy-http"
|
14
14
|
spec.version = EmmyHttp::VERSION
|
15
|
-
spec.authors = ["
|
15
|
+
spec.authors = ["Maksim V."]
|
16
16
|
spec.email = ["inre.storm@gmail.com"]
|
17
|
-
spec.summary = %q{
|
18
|
-
|
17
|
+
spec.summary = %q{Ruby HTTP interface}
|
18
|
+
spec.description = spec.summary
|
19
19
|
spec.homepage = ""
|
20
20
|
spec.license = "MIT"
|
21
21
|
|
@@ -24,15 +24,15 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_dependency "event_object", "~>
|
27
|
+
spec.add_dependency "event_object", "~> 1"
|
28
28
|
spec.add_dependency "emmy-machine", "~> 0.2"
|
29
|
-
spec.add_dependency "fibre", "~>
|
29
|
+
spec.add_dependency "fibre", "~> 1"
|
30
30
|
spec.add_dependency "util_pack", "~> 0.1"
|
31
|
-
spec.add_dependency "model_pack", "~>
|
32
|
-
spec.add_dependency "addressable", "~> 2.
|
31
|
+
spec.add_dependency "model_pack", "~> 1"
|
32
|
+
spec.add_dependency "addressable", "~> 2.5"
|
33
33
|
|
34
34
|
spec.add_development_dependency "eventmachine", "~> 1.0"
|
35
|
-
spec.add_development_dependency "bundler", "~> 1.
|
36
|
-
spec.add_development_dependency "rake", "~> 10
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
36
|
+
spec.add_development_dependency "rake", "~> 10"
|
37
37
|
spec.add_development_dependency "rspec", "~> 3"
|
38
38
|
end
|
data/lib/emmy_http.rb
CHANGED
@@ -28,7 +28,7 @@ module EmmyHttp
|
|
28
28
|
autoload :Request, "emmy_http/request"
|
29
29
|
autoload :Operation, "emmy_http/operation"
|
30
30
|
autoload :Response, "emmy_http/response"
|
31
|
-
autoload :
|
31
|
+
autoload :Timer, "emmy_http/timer"
|
32
32
|
autoload :Utils, "emmy_http/utils"
|
33
33
|
autoload :Model, "emmy_http/model"
|
34
34
|
|
data/lib/emmy_http/model.rb
CHANGED
@@ -61,11 +61,11 @@ module EmmyHttp
|
|
61
61
|
define_method name do |path, as: nil|
|
62
62
|
instance.api[as] = {path: path}
|
63
63
|
if as
|
64
|
-
|
64
|
+
define_singleton_method as.to_s do |a=nil|
|
65
65
|
request(path: path).tap { |r| r.update_attributes(a) if a }
|
66
66
|
end
|
67
67
|
|
68
|
-
|
68
|
+
define_singleton_method "#{as}!" do |*a, &b|
|
69
69
|
send(as, *a, &b).operation
|
70
70
|
end
|
71
71
|
end
|
data/lib/emmy_http/operation.rb
CHANGED
data/lib/emmy_http/request.rb
CHANGED
data/lib/emmy_http/timer.rb
CHANGED
data/lib/emmy_http/version.rb
CHANGED
@@ -25,14 +25,14 @@ describe EmmyHttp::Model do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
around do |example|
|
28
|
-
EmmyMachine.
|
28
|
+
EmmyMachine.run_once &example
|
29
29
|
end
|
30
30
|
|
31
31
|
it "has requests from model" do
|
32
32
|
res = {
|
33
33
|
get_response: HTTPBin.get_request!,
|
34
34
|
post_response: HTTPBin.post_request!(form: {a: 5, b: 6})
|
35
|
-
}.
|
35
|
+
}.await
|
36
36
|
|
37
37
|
expect(res[:get_response].status).to be(200)
|
38
38
|
expect(res[:post_response].status).to be(200)
|
@@ -41,7 +41,7 @@ describe EmmyHttp::Model do
|
|
41
41
|
it "inherits models" do
|
42
42
|
http_req = HTTPBin.get_request
|
43
43
|
https_req = HTTPSBin.get_request
|
44
|
-
https_req.
|
44
|
+
https_req.await
|
45
45
|
expect(http_req.real_url.to_s).to eq('http://httpbin.org')
|
46
46
|
expect(https_req.real_url.to_s).to eq('https://httpbin.org')
|
47
47
|
end
|
data/spec/emmy_http_spec.rb
CHANGED
@@ -11,16 +11,16 @@ describe EmmyHttp do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
around do |example|
|
14
|
-
EmmyMachine.
|
14
|
+
EmmyMachine.run_once &example
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should send HTTP-request with the fake adapter" do
|
18
18
|
request = EmmyHttp::Request.new(
|
19
19
|
type: 'get',
|
20
|
-
url: 'http://
|
20
|
+
url: 'http://httpbin.org'
|
21
21
|
)
|
22
22
|
operation = EmmyHttp::Operation.new(request, FakeAdapter.new)
|
23
|
-
response = operation.
|
23
|
+
response = operation.await
|
24
24
|
|
25
25
|
expect(response.status).to be 200
|
26
26
|
expect(response.headers).to include("Content-Type")
|
@@ -28,7 +28,7 @@ describe EmmyHttp do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should send HTTP-request using the short syntax" do
|
31
|
-
response = request(adapter: FakeAdapter, raise_error: false).get('http://google.com').
|
31
|
+
response = request(adapter: FakeAdapter, raise_error: false).get('http://google.com').await
|
32
32
|
|
33
33
|
expect(response).to_not be nil
|
34
34
|
expect(response.status).to be 200
|
@@ -39,9 +39,9 @@ describe EmmyHttp do
|
|
39
39
|
it "should send several requests in parallel" do
|
40
40
|
req = request(adapter: FakeAdapter, raise_error: false)
|
41
41
|
responses = {
|
42
|
-
a: [req.copy.get('http://
|
43
|
-
b: req.copy.get('http://
|
44
|
-
}.
|
42
|
+
a: [req.copy.get('http://httpbin.org'), req.copy.get('http://httpbin.org')],
|
43
|
+
b: req.copy.get('http://httpbin.org')
|
44
|
+
}.await!
|
45
45
|
|
46
46
|
expect(responses[:a][0].status).to be 200
|
47
47
|
expect(responses[:a][1].status).to be 200
|
@@ -49,8 +49,8 @@ describe EmmyHttp do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should be waiting couple seconds" do
|
52
|
-
timeout = EmmyHttp::
|
53
|
-
res = timeout.
|
52
|
+
timeout = EmmyHttp::Timer.new(2)
|
53
|
+
res = timeout.await
|
54
54
|
|
55
55
|
expect(res).to be true
|
56
56
|
end
|
@@ -58,10 +58,10 @@ describe EmmyHttp do
|
|
58
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
|
-
url: 'http://
|
61
|
+
url: 'http://httpbin.org'
|
62
62
|
)
|
63
63
|
request_hash = request.serializable_hash
|
64
64
|
|
65
|
-
expect(request_hash).to include(type: 'get', url: 'http://
|
65
|
+
expect(request_hash).to include(type: 'get', url: 'http://httpbin.org')
|
66
66
|
end
|
67
67
|
end
|
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.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Maksim V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: event_object
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: emmy-machine
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: util_pack
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: addressable
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '2.
|
89
|
+
version: '2.5'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '2.
|
96
|
+
version: '2.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: eventmachine
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,28 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
117
|
+
version: '1.12'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
124
|
+
version: '1.12'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '10
|
131
|
+
version: '10'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '10
|
138
|
+
version: '10'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '3'
|
153
|
-
description:
|
153
|
+
description: Ruby HTTP interface
|
154
154
|
email:
|
155
155
|
- inre.storm@gmail.com
|
156
156
|
executables: []
|
@@ -177,7 +177,6 @@ files:
|
|
177
177
|
- lib/emmy_http/utils.rb
|
178
178
|
- lib/emmy_http/version.rb
|
179
179
|
- spec/emmy_http/model_spec.rb
|
180
|
-
- spec/emmy_http/request_spec.rb
|
181
180
|
- spec/emmy_http/response_spec.rb
|
182
181
|
- spec/emmy_http_spec.rb
|
183
182
|
- spec/fakes.rb
|
@@ -205,12 +204,10 @@ rubyforge_project:
|
|
205
204
|
rubygems_version: 2.5.1
|
206
205
|
signing_key:
|
207
206
|
specification_version: 4
|
208
|
-
summary:
|
207
|
+
summary: Ruby HTTP interface
|
209
208
|
test_files:
|
210
209
|
- spec/emmy_http/model_spec.rb
|
211
|
-
- spec/emmy_http/request_spec.rb
|
212
210
|
- spec/emmy_http/response_spec.rb
|
213
211
|
- spec/emmy_http_spec.rb
|
214
212
|
- spec/fakes.rb
|
215
213
|
- spec/spec_helper.rb
|
216
|
-
has_rdoc:
|