Class: Dryer::Clients::GeneratedClients::Request
- Inherits:
-
Object
- Object
- Dryer::Clients::GeneratedClients::Request
- Defined in:
- lib/dryer/clients/generated_clients/request.rb
Instance Method Summary collapse
-
#initialize(base_url:, method:, path:, path_variables:, headers:, body:) ⇒ Request
constructor
A new instance of Request.
- #send ⇒ Object
Constructor Details
#initialize(base_url:, method:, path:, path_variables:, headers:, body:) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dryer/clients/generated_clients/request.rb', line 7 def initialize( base_url:, method:, path:, path_variables:, headers:, body: ) @base_url = base_url @method = method @path = path @path_variables = path_variables @headers = headers @body = body end |
Instance Method Details
#send ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dryer/clients/generated_clients/request.rb', line 23 def send uri = URI(base_url) Net::HTTP.start( uri.host, uri.port, use_ssl: uri.scheme == "https" ) do |http| http.send_request( method.to_s.upcase, populated_path, body.to_json, headers ) end end |