Module: Acme::Client::HTTPClient
- Defined in:
- lib/acme/client/http_client.rb
Defined Under Namespace
Classes: AcmeMiddleware, ErrorMiddleware
Class Method Summary collapse
-
.new_acme_connection(url:, client:, mode:, options: {}, bad_nonce_retry: 0) ⇒ Faraday::Connection
Creates and returns a new HTTP client designed for the Acme-protocol, with default settings.
-
.new_connection(url:, options: {}) ⇒ Faraday::Connection
Creates and returns a new HTTP client, with default settings.
Class Method Details
.new_acme_connection(url:, client:, mode:, options: {}, bad_nonce_retry: 0) ⇒ Faraday::Connection
Creates and returns a new HTTP client designed for the Acme-protocol, with default settings.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/acme/client/http_client.rb', line 28 def self.new_acme_connection(url:, client:, mode:, options: {}, bad_nonce_retry: 0) new_connection(url: url, options: ) do |configuration| if bad_nonce_retry > 0 configuration.request(:retry, max: bad_nonce_retry, methods: Faraday::Connection::METHODS, exceptions: [Acme::Client::Error::BadNonce]) end configuration.use Acme::Client::HTTPClient::AcmeMiddleware, client: client, mode: mode yield(configuration) if block_given? end end |
.new_connection(url:, options: {}) ⇒ Faraday::Connection
Creates and returns a new HTTP client, with default settings.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/acme/client/http_client.rb', line 9 def self.new_connection(url:, options: {}) Faraday.new(url, ) do |configuration| configuration.use Acme::Client::HTTPClient::ErrorMiddleware yield(configuration) if block_given? configuration.headers[:user_agent] = Acme::Client::USER_AGENT configuration.adapter Faraday.default_adapter end end |