faraday 0.8.11 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.document +6 -0
  2. data/CONTRIBUTING.md +36 -0
  3. data/Gemfile +7 -6
  4. data/LICENSE.md +1 -1
  5. data/README.md +38 -51
  6. data/Rakefile +2 -18
  7. data/faraday.gemspec +34 -0
  8. data/lib/faraday.rb +181 -67
  9. data/lib/faraday/adapter.rb +19 -34
  10. data/lib/faraday/adapter/em_http.rb +24 -10
  11. data/lib/faraday/adapter/em_synchrony.rb +1 -15
  12. data/lib/faraday/adapter/excon.rb +6 -12
  13. data/lib/faraday/adapter/httpclient.rb +92 -0
  14. data/lib/faraday/adapter/net_http.rb +2 -3
  15. data/lib/faraday/adapter/net_http_persistent.rb +3 -15
  16. data/lib/faraday/adapter/patron.rb +13 -21
  17. data/lib/faraday/adapter/rack.rb +0 -2
  18. data/lib/faraday/adapter/test.rb +35 -36
  19. data/lib/faraday/adapter/typhoeus.rb +10 -12
  20. data/lib/faraday/autoload.rb +87 -0
  21. data/lib/faraday/connection.rb +196 -99
  22. data/lib/faraday/error.rb +33 -33
  23. data/lib/faraday/options.rb +215 -0
  24. data/lib/faraday/parameters.rb +193 -0
  25. data/lib/faraday/{builder.rb → rack_builder.rb} +78 -21
  26. data/lib/faraday/request.rb +12 -25
  27. data/lib/faraday/request/authorization.rb +3 -3
  28. data/lib/faraday/request/basic_authentication.rb +1 -1
  29. data/lib/faraday/request/instrumentation.rb +38 -0
  30. data/lib/faraday/request/multipart.rb +10 -9
  31. data/lib/faraday/request/retry.rb +70 -6
  32. data/lib/faraday/request/token_authentication.rb +2 -2
  33. data/lib/faraday/request/url_encoded.rb +7 -6
  34. data/lib/faraday/response.rb +17 -22
  35. data/lib/faraday/response/logger.rb +4 -4
  36. data/lib/faraday/response/raise_error.rb +4 -5
  37. data/lib/faraday/utils.rb +54 -67
  38. data/script/console +7 -0
  39. data/script/release +6 -3
  40. data/script/server +3 -1
  41. data/script/test +7 -33
  42. data/test/adapters/em_http_test.rb +6 -1
  43. data/test/adapters/em_synchrony_test.rb +7 -1
  44. data/test/adapters/excon_test.rb +0 -7
  45. data/test/adapters/httpclient_test.rb +16 -0
  46. data/test/adapters/integration.rb +8 -39
  47. data/test/adapters/logger_test.rb +1 -1
  48. data/test/adapters/net_http_test.rb +0 -31
  49. data/test/adapters/patron_test.rb +1 -1
  50. data/test/adapters/rack_test.rb +0 -5
  51. data/test/adapters/test_middleware_test.rb +19 -4
  52. data/test/adapters/typhoeus_test.rb +20 -3
  53. data/test/authentication_middleware_test.rb +7 -7
  54. data/test/connection_test.rb +52 -75
  55. data/test/env_test.rb +33 -24
  56. data/test/helper.rb +15 -13
  57. data/test/live_server.rb +10 -4
  58. data/test/middleware/instrumentation_test.rb +75 -0
  59. data/test/middleware/retry_test.rb +44 -38
  60. data/test/middleware_stack_test.rb +12 -11
  61. data/test/options_test.rb +126 -0
  62. data/test/request_middleware_test.rb +17 -7
  63. data/test/response_middleware_test.rb +2 -4
  64. data/test/strawberry.rb +2 -0
  65. metadata +82 -28
  66. checksums.yaml +0 -7
  67. data/script/proxy-server +0 -41
  68. data/test/multibyte.txt +0 -1
  69. data/test/parameters_test.rb +0 -24
  70. data/test/utils_test.rb +0 -30
@@ -1 +0,0 @@
1
- ファイル
@@ -1,24 +0,0 @@
1
- require File.expand_path("../helper", __FILE__)
2
-
3
- class TestParameters < Faraday::TestCase
4
- # emulates ActiveSupport::SafeBuffer#gsub
5
- FakeSafeBuffer = Struct.new(:string) do
6
- def to_s() self end
7
- def gsub(regex)
8
- string.gsub(regex) {
9
- match, = $&, '' =~ /a/
10
- yield(match)
11
- }
12
- end
13
- end
14
-
15
- def test_escaping_safe_buffer_nested
16
- monies = FakeSafeBuffer.new("$32,000.00")
17
- assert_equal "a=%2432%2C000.00", Faraday::Utils.build_nested_query("a" => monies)
18
- end
19
-
20
- def test_escaping_safe_buffer_flat
21
- monies = FakeSafeBuffer.new("$32,000.00")
22
- assert_equal "a=%2432%2C000.00", Faraday::Utils.build_query("a" => monies)
23
- end
24
- end
@@ -1,30 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestUtils < Faraday::TestCase
4
-
5
- # emulates ActiveSupport::SafeBuffer#gsub
6
- FakeSafeBuffer = Struct.new(:string) do
7
- def to_s() self end
8
- def gsub(regex)
9
- string.gsub(regex) {
10
- match, = $&, '' =~ /a/
11
- yield match
12
- }
13
- end
14
- end
15
-
16
- def test_escaping_safe_buffer
17
- str = FakeSafeBuffer.new('$32,000.00')
18
- assert_equal '%2432%2C000.00', Faraday::Utils.escape(str)
19
- end
20
-
21
- def test_replace_header_hash
22
- headers = Faraday::Utils::Headers.new('authorization' => 't0ps3cr3t!')
23
- assert headers.include?('authorization')
24
-
25
- headers.replace({'content-type' => 'text/plain'})
26
-
27
- assert !headers.include?('authorization')
28
- end
29
- end
30
-