emmy-extends 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/emmy-extends.gemspec +1 -1
- data/lib/emmy_extends/em_http_request/adapter.rb +2 -2
- data/lib/emmy_extends/httpi/adapter.rb +2 -2
- data/lib/emmy_extends/thin/backend.rb +1 -2
- data/lib/emmy_extends/thin/class_methods.rb +2 -0
- data/lib/emmy_extends/thin/connection.rb +5 -0
- data/lib/emmy_extends/thin/controller.rb +10 -4
- data/lib/emmy_extends/version.rb +1 -1
- data/spec/em_http_request_spec.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62c3d3f001e9b3d11387006dac45b263cc5c5b58
|
4
|
+
data.tar.gz: 2604f4f3c1bf4574bc01b764dc2c33195d96f330
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53f5b935129d09a71a202715b3a30dc3f07f3d33aff5964cebcd163e34f00c764f5199696ad78753916b74721891d60573d75359c560471d14f087b69292f40b
|
7
|
+
data.tar.gz: 9e81ebdc54bcac45cf9db94ae0fced2b06efd296b995090134ff60e11e9833ce9bfbe46ea7c9ced6cfa7da9f9653eed3009a69eed607c10a23427f83b1e67b35
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Add this line to your application's Gemfile:
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
gem 'em-http-request' # if
|
8
|
+
gem 'em-http-request' # if em-http-request required
|
9
9
|
gem 'httpi' # if httpi required
|
10
10
|
gem 'mysql2' # if mysql2 required
|
11
11
|
gem 'savon', github: 'chelovekov/savon' # if savon required
|
@@ -20,7 +20,7 @@ require 'emmy_extends/em_http_request'
|
|
20
20
|
EmmyMachine.run_block do
|
21
21
|
using Fibre::Synchrony
|
22
22
|
request = EmmyHttp::Request.new(
|
23
|
-
|
23
|
+
type: 'get',
|
24
24
|
url: 'http://github.com'
|
25
25
|
)
|
26
26
|
operation1 = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new)
|
data/emmy-extends.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency "eventmachine", "~> 1.0.3"
|
22
22
|
spec.add_dependency "emmy-machine", "~> 0.1.6"
|
23
|
-
spec.add_dependency "emmy-http", "~> 0.1.
|
23
|
+
spec.add_dependency "emmy-http", "~> 0.1.2"
|
24
24
|
|
25
25
|
spec.add_development_dependency "rspec", "~> 3"
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.7"
|
@@ -81,8 +81,8 @@ module EmmyExtends
|
|
81
81
|
|
82
82
|
def setup_http_client
|
83
83
|
@http_client = begin
|
84
|
-
|
85
|
-
http_client_options = HttpClientOptions.new(delegate.request.url, request_options,
|
84
|
+
type = delegate.request.type.to_s.upcase # http method
|
85
|
+
http_client_options = HttpClientOptions.new(delegate.request.url, request_options, type)
|
86
86
|
EventMachine::HttpClient.new(@http_request, http_client_options).tap do |client|
|
87
87
|
client.stream do |chunk|
|
88
88
|
@body << chunk
|
@@ -23,7 +23,7 @@ module EmmyExtends
|
|
23
23
|
}
|
24
24
|
end
|
25
25
|
|
26
|
-
def request(
|
26
|
+
def request(type)
|
27
27
|
if @request.on_body
|
28
28
|
raise NotSupportedError, "EM-HTTP-Request does not support response streaming"
|
29
29
|
end
|
@@ -37,7 +37,7 @@ module EmmyExtends
|
|
37
37
|
|
38
38
|
@http_request = EmmyHttp::Request.new(
|
39
39
|
url: build_request_url(@request.url),
|
40
|
-
|
40
|
+
type: type,
|
41
41
|
timeouts: { connect: @request.open_timeout, inactivity: @request.read_timeout },
|
42
42
|
headers: @request.headers.to_hash,
|
43
43
|
body: @request.body,
|
@@ -8,8 +8,7 @@ module EmmyExtends
|
|
8
8
|
def initialize(url, app, options={})
|
9
9
|
@url = URI(url.to_s)
|
10
10
|
@app = app
|
11
|
-
options
|
12
|
-
super(options)
|
11
|
+
super(options_with_defaults(options))
|
13
12
|
end
|
14
13
|
|
15
14
|
def start
|
@@ -33,7 +32,11 @@ module EmmyExtends
|
|
33
32
|
# ssl support
|
34
33
|
if @options[:ssl]
|
35
34
|
server.ssl = true
|
36
|
-
server.ssl_options = {
|
35
|
+
server.ssl_options = {
|
36
|
+
private_key_file: @options[:ssl_key_file],
|
37
|
+
cert_chain_file: @options[:ssl_cert_file],
|
38
|
+
verify_peer: !@options[:ssl_disable_verify]
|
39
|
+
}
|
37
40
|
end
|
38
41
|
|
39
42
|
# Detach the process, after this line the current process returns
|
@@ -56,8 +59,11 @@ module EmmyExtends
|
|
56
59
|
|
57
60
|
def options_with_defaults(opt)
|
58
61
|
{
|
62
|
+
backend: EmmyExtends::Thin::Backend,
|
63
|
+
threaded: false,
|
64
|
+
no_epoll: false,
|
59
65
|
chdir: Dir.pwd,
|
60
|
-
environment:
|
66
|
+
environment: 'development',
|
61
67
|
address: '0.0.0.0',
|
62
68
|
port: 3434,
|
63
69
|
timeout: 30, #sec
|
data/lib/emmy_extends/version.rb
CHANGED
@@ -9,7 +9,7 @@ describe EmmyExtends::EmHttpRequest do
|
|
9
9
|
|
10
10
|
it "should send request to httpbin.org" do
|
11
11
|
request = EmmyHttp::Request.new(
|
12
|
-
|
12
|
+
type: 'get',
|
13
13
|
url: 'http://httpbin.org'
|
14
14
|
)
|
15
15
|
operation = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new)
|
@@ -23,7 +23,7 @@ describe EmmyExtends::EmHttpRequest do
|
|
23
23
|
|
24
24
|
it "should send https request to httpbin.org" do
|
25
25
|
request = EmmyHttp::Request.new(
|
26
|
-
|
26
|
+
type: 'get',
|
27
27
|
url: 'https://httpbin.org'
|
28
28
|
)
|
29
29
|
operation = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new)
|
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- che
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.2
|
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: 0.1.
|
54
|
+
version: 0.1.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|