async-http-faraday 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 543e11733a663d5fd57986ff137c0133331b4f762b559c319ce1177dbc8e31e4
4
- data.tar.gz: fe09ce734a351803655f1f0a425eba6fa984bd54d07a6b6a3143aff46e9efa74
3
+ metadata.gz: c3de5d2e0aeda370b0fb885fb00abe5781492da63ee7ba7a0b36da91ea15df75
4
+ data.tar.gz: a5fc3ac76a50db186cadf826c4e458029b337574ad9771365f2015d0be30a276
5
5
  SHA512:
6
- metadata.gz: d9fffa1b0acebcb1afbb5f94038f341ea40f52fb8241f4fcd64b33ca8109e0008b02bf33101ec9e1cd5914b5395fdf21dce4df5837c4aff72fca75144b9fa12f
7
- data.tar.gz: ad7db9fe88686d2f5b229b77387be280751744046bff62f87580cb6e6ac21d1633e0e69ccc73ad1da4fbea6cc8ecdaa194f6c37fded6652874542a9cbee0200b
6
+ metadata.gz: 29096ef34c9bda8c50c62422cfd9a353c331d91fb3a61c8d621e90a0c8d7c0b12ff591f3e520e2c485a84e8f6c1519153d9c36f18e8a90bf627719d7787f6adb
7
+ data.tar.gz: 9ee7b48f082dc8297ff05164988095d2ffcb3954a6b68c86eb52e7a0d2f348f83a5dc7209232c71c898a0d53b522172b7210b6e1b5da0e98a88a69a8e07c8ff1
data/lib/.DS_Store ADDED
Binary file
@@ -30,9 +30,6 @@ require_relative 'agent'
30
30
  module Async
31
31
  module HTTP
32
32
  module Faraday
33
- # Detect whether we can use persistent connections:
34
- PERSISTENT = ::Faraday::Connection.instance_methods.include?(:close)
35
-
36
33
  class Adapter < ::Faraday::Adapter
37
34
  CONNECTION_EXCEPTIONS = [
38
35
  Errno::EADDRNOTAVAIL,
@@ -46,12 +43,12 @@ module Async
46
43
  IOError,
47
44
  SocketError
48
45
  ].freeze
49
-
46
+
50
47
  def initialize(*arguments, **options, &block)
51
48
  super
52
49
 
53
50
  @internet = Async::HTTP::Internet.new
54
- @persistent = PERSISTENT && options.fetch(:persistent, true)
51
+ @persistent = options.fetch(:persistent, true)
55
52
  @timeout = options[:timeout]
56
53
  end
57
54
 
@@ -62,19 +59,12 @@ module Async
62
59
  def call(env)
63
60
  super
64
61
 
65
- parent = Async::Task.current?
66
-
67
62
  Sync do
68
63
  with_timeout do
69
64
  response = @internet.call(env[:method].to_s.upcase, env[:url].to_s, env[:request_headers], env[:body] || [])
70
65
 
71
66
  save_response(env, response.status, response.read, response.headers)
72
67
  end
73
- ensure
74
- # If we are the top level task, even if we are persistent, we must close the connection:
75
- if parent.nil? || !@persistent
76
- @internet.close
77
- end
78
68
  end
79
69
 
80
70
  return @app.call(env)
@@ -85,9 +75,9 @@ module Async
85
75
  rescue *CONNECTION_EXCEPTIONS => e
86
76
  raise ::Faraday::ConnectionFailed, e
87
77
  end
88
-
78
+
89
79
  private
90
-
80
+
91
81
  def with_timeout(task: Async::Task.current)
92
82
  if @timeout
93
83
  task.with_timeout(@timeout, ::Faraday::TimeoutError) do
@@ -23,7 +23,7 @@
23
23
  module Async
24
24
  module HTTP
25
25
  module Faraday
26
- VERSION = "0.9.0"
26
+ VERSION = "0.10.0"
27
27
  end
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http-faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2021-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bake-bundler
56
+ name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rspec
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,30 +94,24 @@ dependencies:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
96
  version: '3.6'
111
- description:
97
+ description:
112
98
  email:
113
- - samuel.williams@oriontransfer.co.nz
114
99
  executables: []
115
100
  extensions: []
116
101
  extra_rdoc_files: []
117
102
  files:
118
- - ".editorconfig"
119
- - ".gitignore"
120
- - ".rspec"
121
- - ".travis.yml"
122
- - Gemfile
123
- - README.md
124
- - async-http-faraday.gemspec
125
103
  - examples/topics.rb
104
+ - lib/.DS_Store
126
105
  - lib/async/http/faraday.rb
127
106
  - lib/async/http/faraday/adapter.rb
128
107
  - lib/async/http/faraday/agent.rb
129
108
  - lib/async/http/faraday/default.rb
130
109
  - lib/async/http/faraday/version.rb
131
110
  homepage: https://github.com/socketry/async-http
132
- licenses: []
111
+ licenses:
112
+ - MIT
133
113
  metadata: {}
134
- post_install_message:
114
+ post_install_message:
135
115
  rdoc_options: []
136
116
  require_paths:
137
117
  - lib
@@ -146,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
126
  - !ruby/object:Gem::Version
147
127
  version: '0'
148
128
  requirements: []
149
- rubygems_version: 3.1.2
150
- signing_key:
129
+ rubygems_version: 3.2.15
130
+ signing_key:
151
131
  specification_version: 4
152
132
  summary: Provides an adaptor between async-http and faraday.
153
133
  test_files: []
data/.editorconfig DELETED
@@ -1,6 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
13
- .covered.db
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,19 +0,0 @@
1
- language: ruby
2
- dist: trusty
3
- cache: bundler
4
-
5
- script: bundle exec rspec
6
-
7
- matrix:
8
- include:
9
- - rvm: 2.5
10
- - rvm: 2.6
11
- - rvm: 2.7
12
- - rvm: jruby-head
13
- env: JRUBY_OPTS="--debug -X+O"
14
- - rvm: truffleruby
15
- - rvm: ruby-head
16
- allow_failures:
17
- - rvm: ruby-head
18
- - rvm: truffleruby
19
- - rvm: jruby-head
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- # gem "faraday", git: "https://github.com/lostisland/faraday.git"
8
- # gem "async-http", path: "../async-http"
data/README.md DELETED
@@ -1,91 +0,0 @@
1
- # Async::HTTP::Faraday
2
-
3
- Provides an adaptor for [Faraday] to perform async HTTP requests. If you are designing a new library, you should probably just use `Async::HTTP::Client` directly.
4
-
5
- [![Build Status](https://travis-ci.com/socketry/async-http-faraday.svg?branch=master)](https://travis-ci.com/socketry/async-http-faraday)
6
- [![Code Climate](https://codeclimate.com/github/socketry/async-http-faraday.svg)](https://codeclimate.com/github/socketry/async-http-faraday)
7
- [![Coverage Status](https://coveralls.io/repos/socketry/async-http-faraday/badge.svg)](https://coveralls.io/r/socketry/async-http-faraday)
8
-
9
- [async]: https://github.com/socketry/async
10
- [async-io]: https://github.com/socketry/async-io
11
- [Faraday]: https://github.com/lostisland/faraday
12
-
13
- ## Installation
14
-
15
- Add this line to your application's Gemfile:
16
-
17
- ```ruby
18
- gem 'async-http-faraday'
19
- ```
20
-
21
- And then execute:
22
-
23
- $ bundle
24
-
25
- Or install it yourself as:
26
-
27
- $ gem install async-http-faraday
28
-
29
- ## Usage
30
-
31
- Here is how you set faraday to use `Async::HTTP`:
32
-
33
- ```ruby
34
- require 'async/http/faraday'
35
-
36
- # Make it the global default:
37
- Faraday.default_adapter = :async_http
38
-
39
- # Per connection:
40
- conn = Faraday.new(...) do |faraday|
41
- faraday.adapter :async_http
42
- end
43
- ```
44
-
45
- Here is how you make a request:
46
-
47
- ```ruby
48
- Async::Reactor.run do
49
- response = conn.get("/index")
50
- end
51
- ```
52
-
53
- ### Default
54
-
55
- To make this the default adaptor:
56
-
57
- ```ruby
58
- require 'async/http/faraday/default'
59
- ```
60
-
61
- ## Contributing
62
-
63
- 1. Fork it
64
- 2. Create your feature branch (`git checkout -b my-new-feature`)
65
- 3. Commit your changes (`git commit -am 'Add some feature'`)
66
- 4. Push to the branch (`git push origin my-new-feature`)
67
- 5. Create new Pull Request
68
-
69
- ## License
70
-
71
- Released under the MIT license.
72
-
73
- Copyright, 2015, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
74
-
75
- Permission is hereby granted, free of charge, to any person obtaining a copy
76
- of this software and associated documentation files (the "Software"), to deal
77
- in the Software without restriction, including without limitation the rights
78
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
79
- copies of the Software, and to permit persons to whom the Software is
80
- furnished to do so, subject to the following conditions:
81
-
82
- The above copyright notice and this permission notice shall be included in
83
- all copies or substantial portions of the Software.
84
-
85
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
86
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
87
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
88
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
90
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
91
- THE SOFTWARE.
@@ -1,29 +0,0 @@
1
-
2
- require_relative 'lib/async/http/faraday/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "async-http-faraday"
6
- spec.version = Async::HTTP::Faraday::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = "Provides an adaptor between async-http and faraday."
11
- spec.homepage = "https://github.com/socketry/async-http"
12
-
13
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
- f.match(%r{^(test|spec|features)/})
15
- end
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_dependency("async-http", "~> 0.42")
20
- spec.add_dependency("faraday")
21
-
22
- spec.add_development_dependency "async-rspec", "~> 1.2"
23
-
24
- spec.add_development_dependency "bake-bundler"
25
-
26
- spec.add_development_dependency "covered"
27
- spec.add_development_dependency "bundler"
28
- spec.add_development_dependency "rspec", "~> 3.6"
29
- end