Class: Mercadopago::HttpClient
- Inherits:
-
Object
- Object
- Mercadopago::HttpClient
- Defined in:
- lib/mercadopago/http/http_client.rb
Overview
Low-level HTTP transport layer built on top of Faraday.
Constant Summary collapse
- RETRYABLE_STATUSES =
RequestOptions::DEFAULT_RETRY_ON.freeze
- DEFAULT_INITIAL_MS =
1000- DEFAULT_MAX_DELAY_MS =
RequestOptions::DEFAULT_MAX_DELAY
Instance Method Summary collapse
- #delete(url:, headers:, timeout: nil) ⇒ Object
-
#get(url:, headers:, params: nil, timeout: nil, maxretries: nil, retry_on: nil, initial_delay_ms: nil, max_delay_ms: nil, jitter: false, on_retry: nil) ⇒ Object
GET with configurable retry + exponential backoff + jitter.
- #post(url:, data:, headers:, timeout: nil) ⇒ Object
- #put(url:, data:, headers:, timeout: nil) ⇒ Object
Instance Method Details
#delete(url:, headers:, timeout: nil) ⇒ Object
33 34 35 |
# File 'lib/mercadopago/http/http_client.rb', line 33 def delete(url:, headers:, timeout: nil) build_result(execute(:delete, url, headers: headers, timeout: timeout), allow_empty: true) end |
#get(url:, headers:, params: nil, timeout: nil, maxretries: nil, retry_on: nil, initial_delay_ms: nil, max_delay_ms: nil, jitter: false, on_retry: nil) ⇒ Object
GET with configurable retry + exponential backoff + jitter
16 17 18 19 20 21 22 23 |
# File 'lib/mercadopago/http/http_client.rb', line 16 def get(url:, headers:, params: nil, timeout: nil, maxretries: nil, retry_on: nil, initial_delay_ms: nil, max_delay_ms: nil, jitter: false, on_retry: nil) with_retry(url: url, method: :get, headers: headers, params: params, timeout: timeout, maxretries: maxretries, retry_on: retry_on, initial_delay_ms: initial_delay_ms, max_delay_ms: max_delay_ms, jitter: jitter, on_retry: on_retry) end |
#post(url:, data:, headers:, timeout: nil) ⇒ Object
25 26 27 |
# File 'lib/mercadopago/http/http_client.rb', line 25 def post(url:, data:, headers:, timeout: nil) build_result(execute(:post, url, headers: headers, body: data, timeout: timeout)) end |
#put(url:, data:, headers:, timeout: nil) ⇒ Object
29 30 31 |
# File 'lib/mercadopago/http/http_client.rb', line 29 def put(url:, data:, headers:, timeout: nil) build_result(execute(:put, url, headers: headers, body: data, timeout: timeout)) end |