faraday 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,29 +1,24 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'addressable', '~> 2.2.6'
4
- gem 'multipart-post', '~> 1.1.0'
5
- gem 'rack', ['>= 1.1.0', '<= 1.2.0']
6
-
7
3
  group :development do
8
4
  gem 'sinatra', '~> 1.2'
9
5
  end
10
6
 
11
7
  group :test do
12
- gem 'em-http-request', '~> 0.3', :require => 'em-http'
13
- gem 'em-synchrony', '~> 0.2', :require => ['em-synchrony', 'em-synchrony/em-http'], :platforms => :ruby_19
8
+ gem 'em-http-request', '~> 1.0', :require => 'em-http'
9
+ gem 'em-synchrony', '~> 1.0', :require => ['em-synchrony', 'em-synchrony/em-http'], :platforms => :ruby_19
14
10
  gem 'excon', '~> 0.6'
15
11
  gem 'leftright', '~> 0.9', :require => false
16
12
  gem 'patron', '~> 0.4'
17
- gem 'rake', '~> 0.8'
18
- gem 'test-unit', '~> 2.3'
19
13
  gem 'typhoeus', '~> 0.2'
20
- gem 'webmock', '~> 1.6'
21
14
  # ActiveSupport::JSON will be used in ruby 1.8 and Yajl in 1.9; this is to test against both adapters
22
15
  gem 'activesupport', '~> 2.3', :require => nil, :platforms => [:ruby_18, :jruby]
23
- gem 'yajl-ruby', '~> 0.8', :require => 'yajl', :platforms => :ruby_19
16
+ gem 'yajl-ruby', '~> 1.0', :require => 'yajl', :platforms => :ruby_19
24
17
  end
25
18
 
26
19
  platforms :jruby do
27
20
  gem 'jruby-openssl', '~> 0.7'
28
21
  gem 'ffi-ncurses', '~> 0.3'
29
22
  end
23
+
24
+ gemspec
data/README.md CHANGED
@@ -161,6 +161,32 @@ Note on Patches/Pull Requests
161
161
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
162
162
  * Send me a pull request. Bonus points for topic branches.
163
163
 
164
+ Supported Rubies
165
+ ----------------
166
+ This library aims to support and is [tested
167
+ against](http://travis-ci.org/technoweenie/faraday) the following Ruby
168
+ implementations:
169
+
170
+ * Ruby 1.8.7
171
+ * Ruby 1.9.1
172
+ * Ruby 1.9.2
173
+ * [Rubinius](http://rubini.us)
174
+ * [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/)
175
+
176
+ If something doesn't work on one of these interpreters, it should be considered
177
+ a bug.
178
+
179
+ This library may inadvertently work (or seem to work) on other Ruby
180
+ implementations, however support will only be provided for the versions listed
181
+ above.
182
+
183
+ If you would like this library to support another Ruby version, you may
184
+ volunteer to be a maintainer. Being a maintainer entails making sure all tests
185
+ run and pass on that implementation. When something breaks on your
186
+ implementation, you will be personally responsible for providing patches in a
187
+ timely fashion. If critical issues for a particular implementation exist at the
188
+ time of a major release, support for that Ruby version may be dropped.
189
+
164
190
  Copyright
165
191
  ---------
166
192
  Copyright (c) 2009-2011 rick, hobson. See [LICENSE][license] for details.
data/Rakefile CHANGED
File without changes
@@ -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.7.4'
16
- s.date = '2011-07-08'
15
+ s.version = '0.7.5'
16
+ s.date = '2011-10-04'
17
17
  s.rubyforge_project = 'faraday'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
@@ -32,12 +32,12 @@ Gem::Specification.new do |s|
32
32
  ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
33
33
  s.require_paths = %w[lib]
34
34
 
35
+ s.add_dependency 'addressable', '~> 2.2.6'
36
+ s.add_dependency 'multipart-post', '~> 1.1.3'
37
+ s.add_dependency 'rack', ['>= 1.1.0', '< 2']
35
38
  s.add_development_dependency 'rake', '~> 0.9'
36
- s.add_development_dependency 'test-unit', '~> 2.3'
37
- s.add_development_dependency 'webmock', '~> 1.6'
38
- s.add_runtime_dependency 'addressable', '~> 2.2.6'
39
- s.add_runtime_dependency 'multipart-post', '~> 1.1.0'
40
- s.add_runtime_dependency 'rack', ['>= 1.1.0', '< 2']
39
+ s.add_development_dependency 'test-unit', '~> 2.4'
40
+ s.add_development_dependency 'webmock', '~> 1.7'
41
41
 
42
42
  ## Leave this section as-is. It will be automatically generated from the
43
43
  ## contents of your Git repository via the gemspec task. DO NOT REMOVE
@@ -88,5 +88,5 @@ Gem::Specification.new do |s|
88
88
 
89
89
  ## Test files will be grabbed from the file list. Make sure the path glob
90
90
  ## matches what you actually use.
91
- s.test_files = s.files.select { |path| path =~ /^test\/.*_test\.rb/ }
91
+ s.test_files = s.files.select { |path| path =~ %r{^test/*/.+\.rb} }
92
92
  end
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
- VERSION = "0.7.4"
2
+ VERSION = "0.7.5"
3
3
 
4
4
  class << self
5
5
  attr_accessor :default_adapter
@@ -16,8 +16,19 @@ module Faraday
16
16
  http = net_http_class(env).new(url.host, url.inferred_port)
17
17
 
18
18
  if http.use_ssl = (url.scheme == 'https' && (ssl = env[:ssl]) && true)
19
- http.verify_mode = ssl[:verify_mode] || ssl.fetch(:verify, true) ?
20
- OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
19
+ http.verify_mode = ssl[:verify_mode] || begin
20
+ if ssl.fetch(:verify, true)
21
+ OpenSSL::SSL::VERIFY_PEER
22
+ # Use the default cert store by default, i.e. system ca certs
23
+ store = OpenSSL::X509::Store.new
24
+ store.set_default_paths
25
+ http.cert_store = store
26
+ OpenSSL::SSL::VERIFY_PEER
27
+ else
28
+ OpenSSL::SSL::VERIFY_NONE
29
+ end
30
+ end
31
+
21
32
  http.cert = ssl[:client_cert] if ssl[:client_cert]
22
33
  http.key = ssl[:client_key] if ssl[:client_key]
23
34
  http.ca_file = ssl[:ca_file] if ssl[:ca_file]
@@ -29,6 +29,16 @@ module Faraday
29
29
  end
30
30
 
31
31
  env_req = env[:request]
32
+
33
+ if proxy = env_req[:proxy]
34
+ req.proxy = "#{proxy[:uri].host}:#{proxy[:uri].port}"
35
+
36
+ if proxy[:username] && proxy[:password]
37
+ req.proxy_username = proxy[:username]
38
+ req.proxy_password = proxy[:password]
39
+ end
40
+ end
41
+
32
42
  req.timeout = req.connect_timeout = (env_req[:timeout] * 1000) if env_req[:timeout]
33
43
  req.connect_timeout = (env_req[:open_timeout] * 1000) if env_req[:open_timeout]
34
44
 
@@ -1,6 +1,10 @@
1
1
  require 'addressable/uri'
2
- require 'set'
3
2
  require 'base64'
3
+ require 'set'
4
+ require 'faraday/builder'
5
+ require 'faraday/request'
6
+ require 'faraday/response'
7
+ require 'faraday/utils'
4
8
 
5
9
  module Faraday
6
10
  class Connection
@@ -233,7 +237,7 @@ module Faraday
233
237
  end
234
238
 
235
239
  def dup
236
- self.class.new(build_url(''), :headers => headers.dup, :params => params.dup, :builder => builder.dup)
240
+ self.class.new(build_url(''), :headers => headers.dup, :params => params.dup, :builder => builder.dup, :ssl => ssl.dup)
237
241
  end
238
242
 
239
243
  def proxy_arg_to_uri(arg)
@@ -238,15 +238,16 @@ class TestConnection < Faraday::TestCase
238
238
  end
239
239
 
240
240
  def test_dups_connection_object
241
- conn = Faraday::Connection.new 'http://sushi.com/foo' do |b|
241
+ conn = Faraday::Connection.new 'http://sushi.com/foo', :ssl => { :verify => :none } do |b|
242
242
  b.adapter :net_http
243
243
  end
244
244
  conn.headers['content-type'] = 'text/plain'
245
245
  conn.params['a'] = '1'
246
246
 
247
247
  duped = conn.dup
248
+
248
249
  assert_equal conn.build_url(''), duped.build_url('')
249
- [:headers, :params, :builder].each do |attr|
250
+ [:headers, :params, :builder, :ssl].each do |attr|
250
251
  assert_equal conn.send(attr), duped.send(attr)
251
252
  assert_not_equal conn.send(attr).object_id, duped.send(attr).object_id
252
253
  end
metadata CHANGED
@@ -1,95 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.5
4
5
  prerelease:
5
- version: 0.7.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Rick Olson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-08 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rake
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-10-04 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: addressable
16
+ requirement: &70213347338660 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
18
+ requirements:
21
19
  - - ~>
22
- - !ruby/object:Gem::Version
23
- version: "0.9"
24
- type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: test-unit
20
+ - !ruby/object:Gem::Version
21
+ version: 2.2.6
22
+ type: :runtime
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70213347338660
25
+ - !ruby/object:Gem::Dependency
26
+ name: multipart-post
27
+ requirement: &70213347338000 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
29
+ requirements:
32
30
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: "2.3"
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: webmock
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.3
33
+ type: :runtime
39
34
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70213347338000
36
+ - !ruby/object:Gem::Dependency
37
+ name: rack
38
+ requirement: &70213347336580 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 1.1.0
44
+ - - <
45
+ - !ruby/object:Gem::Version
46
+ version: '2'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: *70213347336580
50
+ - !ruby/object:Gem::Dependency
51
+ name: rake
52
+ requirement: &70213347335860 !ruby/object:Gem::Requirement
41
53
  none: false
42
- requirements:
54
+ requirements:
43
55
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: "1.6"
56
+ - !ruby/object:Gem::Version
57
+ version: '0.9'
46
58
  type: :development
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: addressable
50
59
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
60
+ version_requirements: *70213347335860
61
+ - !ruby/object:Gem::Dependency
62
+ name: test-unit
63
+ requirement: &70213347335220 !ruby/object:Gem::Requirement
52
64
  none: false
53
- requirements:
65
+ requirements:
54
66
  - - ~>
55
- - !ruby/object:Gem::Version
56
- version: 2.2.6
57
- type: :runtime
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: multipart-post
67
+ - !ruby/object:Gem::Version
68
+ version: '2.4'
69
+ type: :development
61
70
  prerelease: false
62
- requirement: &id005 !ruby/object:Gem::Requirement
71
+ version_requirements: *70213347335220
72
+ - !ruby/object:Gem::Dependency
73
+ name: webmock
74
+ requirement: &70213347334540 !ruby/object:Gem::Requirement
63
75
  none: false
64
- requirements:
76
+ requirements:
65
77
  - - ~>
66
- - !ruby/object:Gem::Version
67
- version: 1.1.0
68
- type: :runtime
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
71
- name: rack
78
+ - !ruby/object:Gem::Version
79
+ version: '1.7'
80
+ type: :development
72
81
  prerelease: false
73
- requirement: &id006 !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: 1.1.0
79
- - - <
80
- - !ruby/object:Gem::Version
81
- version: "2"
82
- type: :runtime
83
- version_requirements: *id006
82
+ version_requirements: *70213347334540
84
83
  description: HTTP/REST API client library.
85
84
  email: technoweenie@gmail.com
86
85
  executables: []
87
-
88
86
  extensions: []
89
-
90
87
  extra_rdoc_files: []
91
-
92
- files:
88
+ files:
93
89
  - Gemfile
94
90
  - LICENSE.md
95
91
  - README.md
@@ -131,38 +127,37 @@ files:
131
127
  - test/response_middleware_test.rb
132
128
  homepage: http://github.com/technoweenie/faraday
133
129
  licenses: []
134
-
135
130
  post_install_message:
136
131
  rdoc_options: []
137
-
138
- require_paths:
132
+ require_paths:
139
133
  - lib
140
- required_ruby_version: !ruby/object:Gem::Requirement
134
+ required_ruby_version: !ruby/object:Gem::Requirement
141
135
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: "0"
146
- required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
141
  none: false
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
151
145
  version: 1.3.5
152
146
  requirements: []
153
-
154
147
  rubyforge_project: faraday
155
- rubygems_version: 1.8.5
148
+ rubygems_version: 1.8.10
156
149
  signing_key:
157
150
  specification_version: 2
158
151
  summary: HTTP/REST API client library.
159
- test_files:
152
+ test_files:
160
153
  - test/adapters/live_test.rb
161
154
  - test/adapters/logger_test.rb
162
155
  - test/adapters/net_http_test.rb
163
156
  - test/adapters/test_middleware_test.rb
164
157
  - test/connection_test.rb
165
158
  - test/env_test.rb
159
+ - test/helper.rb
160
+ - test/live_server.rb
166
161
  - test/middleware_stack_test.rb
167
162
  - test/request_middleware_test.rb
168
163
  - test/response_middleware_test.rb