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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3445b83150979fc91751faea105e47ab4959f2a4
4
- data.tar.gz: bb928f912f37a0f3517b5a9b7da756ac8d0f494e
3
+ metadata.gz: 62c3d3f001e9b3d11387006dac45b263cc5c5b58
4
+ data.tar.gz: 2604f4f3c1bf4574bc01b764dc2c33195d96f330
5
5
  SHA512:
6
- metadata.gz: 29b398950507b0298e357c9338ceb5ff746509773fbf0f57b3e2c5aadefa954f8a1f638b4a8ff6cfb41f5da8a23a80bcd420500d855c4e15d9122c892cceb06a
7
- data.tar.gz: be3c1b5191ca3f576b4eaae238a08a9fc875d65d24231d8c5e0983841f16f1a7d63c534b00ba2bc104f61b853464fa68fa7ad502ee2dd33929076729df5c7591
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 savon em-http-request
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
- method: 'get',
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.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
- method = delegate.request.method.to_s.upcase
85
- http_client_options = HttpClientOptions.new(delegate.request.url, request_options, method)
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(method)
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
- method: method,
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,
@@ -29,8 +29,7 @@ module EmmyExtends
29
29
  conn.delegate = thin_connection
30
30
  super(thin_connection)
31
31
  @running = true # FIXME: maybe not here
32
-
33
- conn.following.post_init
32
+ conn.delegate.post_init
34
33
  end
35
34
 
36
35
  def to_a
@@ -1,3 +1,5 @@
1
+ require "emmy_extends/core_ext"
2
+
1
3
  module EmmyExtends
2
4
  module Thin::ClassMethods
3
5
  using CoreExt
@@ -6,6 +6,11 @@ module EmmyExtends
6
6
  @delegate.unbind
7
7
  end
8
8
 
9
+ def receive_data(*a)
10
+ @delegate.receive_data(*a)
11
+ end
12
+
13
+ # fix me did not works
9
14
  def method_missing(name, *a, &b)
10
15
  @delegate.send(name, *a, &b)
11
16
  end
@@ -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[:backend] ||= EmmyExtends::Thin::Backend
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 = { :private_key_file => @options[:ssl_key_file], :cert_chain_file => @options[:ssl_cert_file], :verify_peer => !@options[:ssl_disable_verify] }
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: env,
66
+ environment: 'development',
61
67
  address: '0.0.0.0',
62
68
  port: 3434,
63
69
  timeout: 30, #sec
@@ -1,3 +1,3 @@
1
1
  module EmmyExtends
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -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
- method: 'get',
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
- method: 'get',
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.5
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-10-07 00:00:00.000000000 Z
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.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.1
54
+ version: 0.1.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement