Class: Sbmt::Strangler::Http::Client
- Inherits:
-
Object
- Object
- Sbmt::Strangler::Http::Client
- Includes:
- Dry::Monads::Result::Mixin
- Defined in:
- lib/sbmt/strangler/http/client.rb
Instance Method Summary collapse
- #call(url, http_verb, payload: {}, headers: {}) ⇒ Object
-
#initialize(http_options: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(http_options: nil) ⇒ Client
Returns a new instance of Client.
9 10 11 |
# File 'lib/sbmt/strangler/http/client.rb', line 9 def initialize(http_options: nil) @http_options = end |
Instance Method Details
#call(url, http_verb, payload: {}, headers: {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sbmt/strangler/http/client.rb', line 13 def call(url, http_verb, payload: {}, headers: {}) case http_verb.downcase when :get transport.get_request(url, params: payload, headers: prepare_headers(headers)) when :post transport.post_request(url, body: payload, headers: prepare_headers(headers)) when :put transport.put_request(url, body: payload, headers: prepare_headers(headers)) else raise "unsupported http verb - #{http_verb}" end end |