From 9b459b9aaebd7d7c9971a060ee67d4e7b09f1a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Augusto?= Date: Mon, 17 Jan 2022 22:04:44 -0300 Subject: [PATCH 1/3] update docs to a httpbingo on example requests and adding webrick --- docs/Gemfile | 2 ++ docs/usage/customize.md | 8 ++++---- docs/usage/streaming.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/Gemfile b/docs/Gemfile index 14d91b3d4..c768037bb 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -32,3 +32,5 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] # Performance-booster for watching directories on Windows gem 'wdm', '~> 0.1.0' if Gem.win_platform? + +gem "webrick", "~> 1.7" diff --git a/docs/usage/customize.md b/docs/usage/customize.md index adf40031a..de7d5d880 100644 --- a/docs/usage/customize.md +++ b/docs/usage/customize.md @@ -14,15 +14,15 @@ Configuration can be set up with the connection and/or adjusted per request. As connection options: ```ruby -conn = Faraday.new('http://sushi.com', request: { timeout: 5 }) -conn.get('/search') +conn = Faraday.new('http://httpbingo.org', request: { timeout: 5 }) +conn.get('/ip') ``` Or as per-request options: ```ruby conn.get do |req| - req.url '/search' + req.url '/ip' req.options.timeout = 5 end ``` @@ -32,7 +32,7 @@ This will be available in the `env` on all middleware. ```ruby conn.get do |req| - req.url '/search' + req.url '/get' req.options.context = { foo: 'foo', bar: 'bar' diff --git a/docs/usage/streaming.md b/docs/usage/streaming.md index 26a3d3371..d3d60e600 100644 --- a/docs/usage/streaming.md +++ b/docs/usage/streaming.md @@ -21,7 +21,7 @@ This example implements such a callback: # A buffer to store the streamed data streamed = [] -conn.get('/nigiri/sake.json') do |req| +conn.get('/stream/10') do |req| # Set a callback which will receive tuples of chunk Strings # and the sum of characters received so far req.options.on_data = Proc.new do |chunk, overall_received_bytes| From 6c6d03131b9fde4e21c03044e30470fc085859cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Augusto?= Date: Tue, 18 Jan 2022 07:24:29 -0300 Subject: [PATCH 2/3] fixing rubocop offenses --- docs/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile b/docs/Gemfile index c768037bb..751bf9899 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -33,4 +33,4 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] # Performance-booster for watching directories on Windows gem 'wdm', '~> 0.1.0' if Gem.win_platform? -gem "webrick", "~> 1.7" +gem 'webrick', '~> 1.7' From 67a2bc60cb0306b4f1bf6d5cec912d62bbaa92e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Augusto?= Date: Tue, 18 Jan 2022 07:39:17 -0300 Subject: [PATCH 3/3] adding a comment to explain why have to adding a new gem --- docs/Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Gemfile b/docs/Gemfile index 751bf9899..6ec55f4e0 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -33,4 +33,5 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] # Performance-booster for watching directories on Windows gem 'wdm', '~> 0.1.0' if Gem.win_platform? +# Ruby 3.X doesn't come with webrick by default anymore gem 'webrick', '~> 1.7'