Class: Multicard::HttpClient
- Inherits:
-
Object
- Object
- Multicard::HttpClient
- Defined in:
- lib/multicard/http_client.rb
Instance Method Summary collapse
- #delete(path, body: nil, params: {}, headers: {}) ⇒ Object
- #get(path, params: {}, headers: {}) ⇒ Object
- #get_with_retry(path, params: {}, headers: {}, retries: 2) ⇒ Object
-
#initialize(config) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #post(path, body: {}, headers: {}) ⇒ Object
Constructor Details
#initialize(config) ⇒ HttpClient
Returns a new instance of HttpClient.
9 10 11 |
# File 'lib/multicard/http_client.rb', line 9 def initialize(config) @config = config end |
Instance Method Details
#delete(path, body: nil, params: {}, headers: {}) ⇒ Object
21 22 23 |
# File 'lib/multicard/http_client.rb', line 21 def delete(path, body: nil, params: {}, headers: {}) request(:delete, path, body: body, params: params, headers: headers) end |
#get(path, params: {}, headers: {}) ⇒ Object
13 14 15 |
# File 'lib/multicard/http_client.rb', line 13 def get(path, params: {}, headers: {}) request(:get, path, params: params, headers: headers) end |
#get_with_retry(path, params: {}, headers: {}, retries: 2) ⇒ Object
25 26 27 |
# File 'lib/multicard/http_client.rb', line 25 def get_with_retry(path, params: {}, headers: {}, retries: 2) request_with_retry(:get, path, params: params, headers: headers, retries: retries) end |
#post(path, body: {}, headers: {}) ⇒ Object
17 18 19 |
# File 'lib/multicard/http_client.rb', line 17 def post(path, body: {}, headers: {}) request(:post, path, body: body, headers: headers) end |