Skip to content

Commit

Permalink
Use digest_auth from faraday-digestauth.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jan 2, 2021
1 parent 8fed27e commit ff81379
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 56 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

### 1.0.1 (Next)

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

### 1.0.0 (2021/01/02)

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

### 0.9.3 (2020/05/14)

Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,19 @@ api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
end
```

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.
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.

```ruby
api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api')
api.digest_auth('username', 'password')
api.headers.update('Accept-Encoding' => 'deflate, gzip')
require 'faraday/digestauth'

api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
client.connection(default: false) do |conn|
conn.request :digest, 'username', 'password'
conn.request :json
conn.response :json, content_type: /\bjson$/
conn.adapter :net_http
end
end
```

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).
Expand Down
2 changes: 0 additions & 2 deletions hyperclient.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Gem::Specification.new do |gem|

gem.add_dependency 'addressable'
gem.add_dependency 'faraday', '>= 0.9.0'
gem.add_dependency 'faraday-digestauth', '>= 0.3.0'
gem.add_dependency 'faraday_hal_middleware'
gem.add_dependency 'faraday_middleware'
gem.add_dependency 'net-http-digest_auth'
end
17 changes: 0 additions & 17 deletions lib/faraday/connection.rb

This file was deleted.

3 changes: 1 addition & 2 deletions lib/hyperclient/entry_point.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'faraday_middleware'
require 'faraday_hal_middleware'
require_relative '../faraday/connection'

module Hyperclient
# Public: Exception that is raised when trying to modify an
Expand Down Expand Up @@ -30,7 +29,7 @@ class EntryPoint < Link
extend Forwardable

# Public: Delegates common methods to be used with the Faraday connection.
def_delegators :connection, :basic_auth, :digest_auth, :token_auth, :params, :params=
def_delegators :connection, :params, :params=

# Public: Initializes an EntryPoint.
#
Expand Down
29 changes: 0 additions & 29 deletions test/faraday/connection_test.rb

This file was deleted.

0 comments on commit ff81379

Please sign in to comment.