faraday-em_synchrony 1.0.0 → 1.0.1

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: adf5bdc8c8903b85d533c3e0e124b5cf55dbce21a695f8cfb0cd859df2f8955e
4
- data.tar.gz: 8e5375bea399c465a5f12f6e0d8b9c00c0dc7d3ca1a2641b1e889fe6e5c07e80
3
+ metadata.gz: ca71eb46cb78c20eb91bc712247221db397daacecdb6d850d2672a2d52ec7bca
4
+ data.tar.gz: 356896b2bb6f6b50e4d5fe14ec63df5cae67b76a2bb250735a077964a088f596
5
5
  SHA512:
6
- metadata.gz: 2e4a52e45b43cffca1e0cea2f99546f5e58097be392028fc0c578a7dfa6c2c43ba1b23a87cda94ca87952a7722f1df005cc0080b2caa277e9b0ce2c67c186d02
7
- data.tar.gz: f0b72ccf6a1b1e744c54f75e3ccee84d93488dc66023b71e89881b457b68dcb015d543ececba8c22356001000469aae5129c1f41f019aea6f3beee4bb1b043f3
6
+ metadata.gz: e0ce5f1f39f2222dd69b433ffb96fe565096790c046ba05a9e71c9997fc6f93bce7f419ee989c7ea3cb595bec717c7af8ed060ac7530de5e558091ed95e38783
7
+ data.tar.gz: baa08aaffda195b6bf3385a63ad4cfaa677f84a8ea17bb7abd0ed9867f77fd17efedf89ed742ab6663773b929b9d3a371d2e90c72fa475af7b3fea48f871fa8c
data/README.md CHANGED
@@ -9,9 +9,6 @@ Every adapter is defined into its own gem. This gem defines the adapter for Em::
9
9
  Add these lines to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'em-http-request', '>= 1.1'
13
- gem 'em-synchrony', '>= 1.0.3'
14
- gem 'faraday-em_http', '~> 1.0'
15
12
  gem 'faraday-em_synchrony'
16
13
  ```
17
14
 
@@ -21,22 +18,55 @@ And then execute:
21
18
 
22
19
  Or install them yourself as:
23
20
 
24
- $ gem install em-http-request -v '>= 1.1'
25
- $ gem install em-synchrony -v '>= 1.0.3'
26
- $ gem install faraday-em_http -v '~> 1.0'
27
21
  $ gem install faraday-em_synchrony
28
22
 
29
23
  ## Usage
30
24
 
31
- Configure your Faraday connection to use this adapter like this:
25
+ This adapter can be used to make parallel requests using EventMachine.
32
26
 
27
+ The key difference between this and [EM-Http](https://github.com/lostisland/faraday-em_http) is that it uses fibers.
28
+ For more information see igrigorik's blog posts on the matter:
29
+
30
+ - [fibers-cooperative-scheduling-in-ruby](https://www.igvita.com/2009/05/13/fibers-cooperative-scheduling-in-ruby/)
31
+ - [untangling-evented-code-with-ruby-fibers](https://www.igvita.com/2010/03/22/untangling-evented-code-with-ruby-fibers)
32
+
33
+ **Error handling and responses have a slightly different behaviour and structure in some cases. Please run thorough testing scenarios, including connection failures and SSL failures**
34
+
35
+ ### Base request
33
36
  ```ruby
34
- connection = Faraday.new(url, conn_options) do |conn|
35
- conn.adapter(:em_synchrony)
37
+ require 'faraday/em_synchrony'
38
+
39
+ conn = Faraday.new(...) do |f|
40
+ # no custom options available
41
+ f.adapter :em_synchrony
36
42
  end
37
43
  ```
38
44
 
39
- For more information on how to setup your Faraday connection and adapters usage, please refer to the [Faraday Website][faraday-website].
45
+ ### Parallel Requests
46
+
47
+ ```ruby
48
+ require 'faraday/em_synchrony'
49
+
50
+ urls = Array.new(5) { 'http://127.0.0.1:3000' }
51
+
52
+ conn = Faraday::Connection.new do |builder|
53
+ builder.adapter :em_synchrony
54
+ end
55
+
56
+ begin
57
+ conn.in_parallel do
58
+ puts "Parallel manager: #{conn.parallel_manager}"
59
+
60
+ @responses = urls.map do |url|
61
+ conn.get(url)
62
+ end
63
+ end
64
+ end
65
+
66
+ # Gather responses outside of block
67
+ puts @responses.map(&:status).join(', ')
68
+ puts @responses.map(&:status).compact.count
69
+ ```
40
70
 
41
71
  ## Development
42
72
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module EmSynchrony
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-em_synchrony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@iMacTia"
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: em-http-request
@@ -212,7 +211,6 @@ metadata:
212
211
  homepage_uri: https://github.com/lostisland/faraday-em_synchrony
213
212
  source_code_uri: https://github.com/lostisland/faraday-em_synchrony
214
213
  changelog_uri: https://github.com/lostisland/faraday-em_synchrony
215
- post_install_message:
216
214
  rdoc_options: []
217
215
  require_paths:
218
216
  - lib
@@ -227,8 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
225
  - !ruby/object:Gem::Version
228
226
  version: '0'
229
227
  requirements: []
230
- rubygems_version: 3.1.6
231
- signing_key:
228
+ rubygems_version: 3.6.7
232
229
  specification_version: 4
233
230
  summary: Faraday adapter for EM::Synchrony
234
231
  test_files: []