emmy-extends 0.2 → 0.2.1

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: 24a6f69f0941e54acfcd890f332fb090d94c0a1b
4
- data.tar.gz: c0fac984497be6ae193848e2f94d7a1826658d50
3
+ metadata.gz: 1624f89876a6b983feb2ef303af554bf028d0c9f
4
+ data.tar.gz: ab8447a5126604596a62355ff97e13a81d2f7171
5
5
  SHA512:
6
- metadata.gz: 4abbe5770d657006bd11916db991c3b01984c74f0841b1b96ee9115e193aac28bbc4e1120c99148f739049efa0e534589e594010b5ba67e7b7411c441bae964c
7
- data.tar.gz: 45337b8049768051e36530c219b27dc308bb3352209783e5b32d151175136d2c36d2129f8dc9d10cdbb975580cd0d5a1529cc21efde05b5275175c0969d50e8c
6
+ metadata.gz: 9ff72bae48a52032402d089316ce980c26031b3620199944d84286a1dac803fbbd92b1372e4a739fffa14f79b582a3203751d0704e4c98f1d24e7cfd24340495
7
+ data.tar.gz: 4d45bb4c53a18dd946634681f8267cd05af034c42a439e88ca62ccb11287256773e07976ec4e4f85a49c98e5d8eafb753034664fe0b32fc49119bb811f2c6667
data/Gemfile CHANGED
@@ -8,3 +8,6 @@ gem 'mysql2'
8
8
  gem 'httpi'
9
9
  gem 'savon', github: 'inre/savon', branch: 'version2'
10
10
  gem 'remailer'
11
+
12
+ gem 'emmy-http', '0.2.13'
13
+ gem 'emmy-machine', '0.1.12'
data/emmy-extends.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "emmy-machine", "~> 0.1"
22
22
  spec.add_dependency "emmy-http", "~> 0.1"
23
23
 
24
- spec.add_development_dependency "eventmachine", "~> 1.0.3"
24
+ spec.add_development_dependency "eventmachine", "~> 1.2.1"
25
25
  spec.add_development_dependency "rspec", "~> 3"
26
26
  spec.add_development_dependency "bundler", "~> 1.7"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
@@ -125,7 +125,7 @@ module EmmyExtends
125
125
  def request_options
126
126
  {
127
127
  redirects: 5,
128
- keepalive: false,
128
+ keepalive: operation.request.keep_alive,
129
129
  path: url.path,
130
130
  query: url.query,
131
131
  body: encode_body(body),
@@ -178,6 +178,7 @@ module EmmyExtends
178
178
  end
179
179
 
180
180
  def setup_http_request
181
+ # return EventMachine::HttpConnection
181
182
  @http_request = EventMachine::HttpRequest.new(url, connection_options)
182
183
  end
183
184
 
@@ -31,7 +31,8 @@ module EmmyExtends
31
31
  if @request.ssl?
32
32
  ssl = {
33
33
  cert_chain_file: @request.auth.ssl.ca_cert_file,
34
- verify_peer: @request.auth.ssl.verify_mode
34
+ verify_peer: @request.auth.ssl.verify_mode,
35
+ ssl_version: @request.auth.ssl.ssl_version
35
36
  }
36
37
  end
37
38
 
@@ -29,7 +29,7 @@ module EmmyExtends
29
29
 
30
30
  on :error do |error, operation, conn|
31
31
  # FIXME: TimeoutError separate
32
- fiber.leave ConnectionError, error.to_s
32
+ fiber.leave EmmyHttp::ConnectionError, error.to_s
33
33
  end
34
34
  end
35
35
  end
@@ -1,6 +1,11 @@
1
1
  require "emmy_extends/em_http_request"
2
2
  require "httpi"
3
3
 
4
+ # TLS FIX:
5
+ class HTTPI::Auth::SSL
6
+ attr_writer :ssl_version
7
+ end
8
+
4
9
  module EmmyExtends
5
10
  module HTTPI
6
11
  require "emmy_extends/httpi/adapter"
@@ -1,3 +1,3 @@
1
1
  module EmmyExtends
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -69,4 +69,29 @@ describe EmmyExtends::EmHttpRequest do
69
69
  expect(response.content_type).to eq("application/json")
70
70
  expect(response.content["json"]).to include('points' => [{'x' => 5, 'y' => 6}, {'x' => 3, 'y' => 2}])
71
71
  end
72
+
73
+ it "sends two request one by one over single connection" do
74
+ req1 = EmmyHttp::Request.new(
75
+ type: 'get',
76
+ url: 'http://httpbin.org/get',
77
+ query: {param: 5},
78
+ keep_alive: true
79
+ )
80
+
81
+ req2 = req1.copy
82
+ # change query params
83
+ req2.query = {param: 10}
84
+
85
+ op1 = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new)
86
+ res1 = op1.sync
87
+
88
+ op2 = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new, op1.connection)
89
+ res2 = op2.sync
90
+ p res2
91
+
92
+ expect(res1).to_not be nil
93
+ expect(res1.status).to be 200
94
+ expect(res2).to_not be nil
95
+ expect(res2.status).to be 200
96
+ end
72
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emmy-extends
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - inre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-23 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: emmy-machine
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.3
47
+ version: 1.2.1
48
48
  type: :development
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: 1.0.3
54
+ version: 1.2.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
- rubygems_version: 2.5.1
170
+ rubygems_version: 2.6.6
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Emmy support em-http-request, thin, savon, mysql2 etc.