faraday 0.5.5 → 0.5.6.pre

Sign up to get free protection for your applications and to get access to all the features.
data/faraday.gemspec CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  ## If your rubyforge_project name is different, then edit it and comment out
13
13
  ## the sub! line in the Rakefile
14
14
  s.name = 'faraday'
15
- s.version = '0.5.5'
16
- s.date = '2011-02-06'
15
+ s.version = '0.5.6.pre'
16
+ s.date = '2011-02-13'
17
17
  s.rubyforge_project = 'faraday'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
51
51
  lib/faraday/adapter.rb
52
52
  lib/faraday/adapter/action_dispatch.rb
53
53
  lib/faraday/adapter/em_synchrony.rb
54
+ lib/faraday/adapter/excon.rb
54
55
  lib/faraday/adapter/net_http.rb
55
56
  lib/faraday/adapter/patron.rb
56
57
  lib/faraday/adapter/test.rb
data/lib/faraday.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6.pre"
3
3
 
4
4
  class << self
5
5
  attr_accessor :default_adapter
@@ -12,6 +12,7 @@ module Faraday
12
12
  :Typhoeus => 'typhoeus',
13
13
  :EMSynchrony => 'em_synchrony',
14
14
  :Patron => 'patron',
15
+ :Excon => 'excon',
15
16
  :Test => 'test'
16
17
 
17
18
  register_lookup_modules \
@@ -20,7 +21,8 @@ module Faraday
20
21
  :net_http => :NetHttp,
21
22
  :typhoeus => :Typhoeus,
22
23
  :patron => :Patron,
23
- :em_synchrony => :EMSynchrony
24
+ :em_synchrony => :EMSynchrony,
25
+ :excon => :Excon
24
26
 
25
27
  def call(env)
26
28
  process_body_for_request(env)
@@ -1,9 +1,12 @@
1
- require 'em-synchrony/em-http'
2
- require 'fiber'
3
-
4
1
  module Faraday
5
2
  class Adapter
6
3
  class EMSynchrony < Faraday::Adapter
4
+ begin
5
+ require 'em-synchrony/em-http'
6
+ require 'fiber'
7
+ rescue LoadError, NameError => e
8
+ self.load_error = e
9
+ end
7
10
 
8
11
  class Header
9
12
  include Net::HTTPHeader
@@ -21,9 +24,7 @@ module Faraday
21
24
 
22
25
  def call(env)
23
26
  process_body_for_request(env)
24
-
25
27
  request = EventMachine::HttpRequest.new(URI::parse(env[:url].to_s))
26
-
27
28
  options = {:head => env[:request_headers]}
28
29
 
29
30
  if env[:body]
@@ -0,0 +1,41 @@
1
+ module Faraday
2
+ class Adapter
3
+ class Excon < Faraday::Adapter
4
+ begin
5
+ require 'excon'
6
+ rescue LoadError, NameError => e
7
+ self.load_error = e
8
+ end
9
+
10
+ def call(env)
11
+ super
12
+
13
+ conn = ::Excon.new(env[:url].to_s)
14
+ if ssl = (env[:url].scheme == 'https' && env[:ssl])
15
+ ::Excon.ssl_verify_peer = !!ssl[:verify] if ssl.key?(:verify)
16
+ if ca_file = ssl[:ca_file]
17
+ ::Excon.ssl_ca_path = ca_file
18
+ end
19
+ end
20
+
21
+ resp = conn.request \
22
+ :method => env[:method].to_s.upcase,
23
+ :headers => env[:request_headers],
24
+ :body => env[:body]
25
+
26
+ env.update \
27
+ :status => resp.status.to_i,
28
+ :response_headers => {},
29
+ :body => resp.body
30
+
31
+ resp.headers.each do |key, value|
32
+ env[:response_headers][key.downcase] = value
33
+ end
34
+
35
+ @app.call env
36
+ rescue ::Excon::Errors::SocketError => e
37
+ raise Error::ConnectionFailed.new(e)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -134,10 +134,9 @@ if Faraday::TestCase::LIVE_SERVER
134
134
  self.send method
135
135
  EM.stop
136
136
  end.resume
137
- end
137
+ end
138
138
  end
139
139
  end
140
-
141
140
  end
142
141
  end
143
142
 
metadata CHANGED
@@ -1,8 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.5.5
4
+ hash: 961916020
5
+ prerelease: true
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 6
10
+ - pre
11
+ version: 0.5.6.pre
6
12
  platform: ruby
7
13
  authors:
8
14
  - Rick Olson
@@ -10,7 +16,7 @@ autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
18
 
13
- date: 2011-02-06 00:00:00 -05:00
19
+ date: 2011-02-13 00:00:00 -08:00
14
20
  default_executable:
15
21
  dependencies:
16
22
  - !ruby/object:Gem::Dependency
@@ -21,6 +27,10 @@ dependencies:
21
27
  requirements:
22
28
  - - ~>
23
29
  - !ruby/object:Gem::Version
30
+ hash: 27
31
+ segments:
32
+ - 0
33
+ - 8
24
34
  version: "0.8"
25
35
  type: :development
26
36
  version_requirements: *id001
@@ -32,6 +42,11 @@ dependencies:
32
42
  requirements:
33
43
  - - ~>
34
44
  - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 2
48
+ - 2
49
+ - 4
35
50
  version: 2.2.4
36
51
  type: :runtime
37
52
  version_requirements: *id002
@@ -43,6 +58,11 @@ dependencies:
43
58
  requirements:
44
59
  - - ~>
45
60
  - !ruby/object:Gem::Version
61
+ hash: 19
62
+ segments:
63
+ - 1
64
+ - 1
65
+ - 0
46
66
  version: 1.1.0
47
67
  type: :runtime
48
68
  version_requirements: *id003
@@ -54,9 +74,17 @@ dependencies:
54
74
  requirements:
55
75
  - - ">="
56
76
  - !ruby/object:Gem::Version
77
+ hash: 19
78
+ segments:
79
+ - 1
80
+ - 1
81
+ - 0
57
82
  version: 1.1.0
58
83
  - - <
59
84
  - !ruby/object:Gem::Version
85
+ hash: 7
86
+ segments:
87
+ - 2
60
88
  version: "2"
61
89
  type: :runtime
62
90
  version_requirements: *id004
@@ -78,6 +106,7 @@ files:
78
106
  - lib/faraday/adapter.rb
79
107
  - lib/faraday/adapter/action_dispatch.rb
80
108
  - lib/faraday/adapter/em_synchrony.rb
109
+ - lib/faraday/adapter/excon.rb
81
110
  - lib/faraday/adapter/net_http.rb
82
111
  - lib/faraday/adapter/patron.rb
83
112
  - lib/faraday/adapter/test.rb
@@ -120,17 +149,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
149
  requirements:
121
150
  - - ">="
122
151
  - !ruby/object:Gem::Version
152
+ hash: 3
153
+ segments:
154
+ - 0
123
155
  version: "0"
124
156
  required_rubygems_version: !ruby/object:Gem::Requirement
125
157
  none: false
126
158
  requirements:
127
- - - ">="
159
+ - - ">"
128
160
  - !ruby/object:Gem::Version
129
- version: 1.3.5
161
+ hash: 25
162
+ segments:
163
+ - 1
164
+ - 3
165
+ - 1
166
+ version: 1.3.1
130
167
  requirements: []
131
168
 
132
169
  rubyforge_project: faraday
133
- rubygems_version: 1.5.0
170
+ rubygems_version: 1.3.7
134
171
  signing_key:
135
172
  specification_version: 2
136
173
  summary: HTTP/REST API client library.