Skip to content

Commit b273050

Browse files
authored
Merge pull request #199 from dblock/digest-auth
Use digest_auth from faraday-digestauth.
2 parents 8fed27e + ff81379 commit b273050

File tree

6 files changed

+16
-56
lines changed

6 files changed

+16
-56
lines changed

CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
### 1.0.1 (Next)
44

5+
* [#193](https://github.com/codegram/hyperclient/pull/193): Auto-paginate collections - [@dblock](https://github.com/dblock).
6+
* [#163](https://github.com/codegram/hyperclient/pull/163): Test against Faraday 0.9, 0.17 and 1.0+ - [@dblock](https://github.com/dblock).
7+
* [#199](https://github.com/codegram/hyperclient/pull/199): Use digest_auth from faraday-digestauth - [@dblock](https://github.com/dblock).
58
* Your contribution here.
69

710
### 1.0.0 (2021/01/02)
811

9-
* [#193](https://github.com/codegram/hyperclient/pull/193): Auto-paginate collections - [@dblock](https://github.com/dblock).
10-
* [#163](https://github.com/codegram/hyperclient/pull/163): Test against Faraday 0.9, 0.17 and 1.0+ - [@dblock](https://github.com/dblock).
12+
* NOTE: **⚠ This version has been yanked ⚠** - [@dblock](https://github.com/dblock).
1113

1214
### 0.9.3 (2020/05/14)
1315

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,19 @@ api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
8585
end
8686
```
8787

88-
You can modify headers or specify authentication after a connection has been created. Hyperclient supports Basic, Token or Digest auth as well as many other Faraday extensions.
88+
You can modify headers or specify authentication after a connection has been created. Hyperclient supports Basic, Token or [Digest auth](https://github.com/bhaberer/faraday-digestauth) as well as many other Faraday extensions.
8989

9090
```ruby
91-
api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api')
92-
api.digest_auth('username', 'password')
93-
api.headers.update('Accept-Encoding' => 'deflate, gzip')
91+
require 'faraday/digestauth'
92+
93+
api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
94+
client.connection(default: false) do |conn|
95+
conn.request :digest, 'username', 'password'
96+
conn.request :json
97+
conn.response :json, content_type: /\bjson$/
98+
conn.adapter :net_http
99+
end
100+
end
94101
```
95102

96103
You can access the Faraday connection directly after it has been created and add middleware to it. As an example, you could use the [faraday-http-cache-middleware](https://github.com/plataformatec/faraday-http-cache).

hyperclient.gemspec

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Gem::Specification.new do |gem|
1515

1616
gem.add_dependency 'addressable'
1717
gem.add_dependency 'faraday', '>= 0.9.0'
18-
gem.add_dependency 'faraday-digestauth', '>= 0.3.0'
1918
gem.add_dependency 'faraday_hal_middleware'
2019
gem.add_dependency 'faraday_middleware'
21-
gem.add_dependency 'net-http-digest_auth'
2220
end

lib/faraday/connection.rb

-17
This file was deleted.

lib/hyperclient/entry_point.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'faraday_middleware'
22
require 'faraday_hal_middleware'
3-
require_relative '../faraday/connection'
43

54
module Hyperclient
65
# Public: Exception that is raised when trying to modify an
@@ -30,7 +29,7 @@ class EntryPoint < Link
3029
extend Forwardable
3130

3231
# Public: Delegates common methods to be used with the Faraday connection.
33-
def_delegators :connection, :basic_auth, :digest_auth, :token_auth, :params, :params=
32+
def_delegators :connection, :params, :params=
3433

3534
# Public: Initializes an EntryPoint.
3635
#

test/faraday/connection_test.rb

-29
This file was deleted.

0 commit comments

Comments
 (0)