Module: LoogiHttp
- Defined in:
- lib/loogi_http.rb,
lib/loogi_http/error.rb,
lib/loogi_http/builder.rb,
lib/loogi_http/version.rb,
lib/loogi_http/response.rb,
lib/loogi_http/connection.rb,
lib/loogi_http/middleware.rb,
lib/loogi_http/configuration.rb,
lib/loogi_http/middleware/debug_http.rb,
lib/loogi_http/middleware/log_request.rb,
lib/loogi_http/middleware/request/accept_json.rb
Defined Under Namespace
Modules: Middleware Classes: Builder, Configuration, Connection, ConnectionFailed, Error, Response, ServerError, TimeoutError
Constant Summary collapse
- VERSION =
'2.1.0'.freeze
Class Method Summary collapse
-
.json_post(url, params: {}, data: nil, options: {}) ⇒ Object
HTTP POST with JSON data sent and expected as the response.
-
.log_level ⇒ Object
The log level to use with the logger.
-
.log_level=(log_level) ⇒ Object
Set the log level to use with the logger.
-
.logger ⇒ Object
The Logger to use when logging.
-
.logger=(logger) ⇒ Object
Set the Logger to use when logging.
Class Method Details
.json_post(url, params: {}, data: nil, options: {}) ⇒ Object
HTTP POST with JSON data sent and expected as the response.
(see LoogiHttp::Connection#post)
35 36 37 38 39 40 41 42 |
# File 'lib/loogi_http.rb', line 35 def self.json_post(url, params: {}, data: nil, options: {}) LoogiHttp::Builder.json.post( url, params: params, data: data, options: ) end |
.log_level ⇒ Object
The log level to use with the logger. Defaults to info.
8 9 10 |
# File 'lib/loogi_http.rb', line 8 def self.log_level @log_level ||= :info end |
.log_level=(log_level) ⇒ Object
Set the log level to use with the logger
15 16 17 |
# File 'lib/loogi_http.rb', line 15 def self.log_level=(log_level) @log_level = log_level end |
.logger ⇒ Object
The Logger to use when logging
20 21 22 |
# File 'lib/loogi_http.rb', line 20 def self.logger @logger ||= nil # Silence warning end |
.logger=(logger) ⇒ Object
Set the Logger to use when logging
27 28 29 |
# File 'lib/loogi_http.rb', line 27 def self.logger=(logger) @logger = logger end |