Class: NiceJsonApi::Response::SingleRequest
- Inherits:
-
Object
- Object
- NiceJsonApi::Response::SingleRequest
- Defined in:
- lib/nice_json_api.rb
Overview
Do a single html request
Instance Method Summary collapse
-
#initialize(uri, method: :get, body: nil, auth: nil) ⇒ SingleRequest
constructor
A new instance of SingleRequest.
- #response ⇒ Object
Constructor Details
#initialize(uri, method: :get, body: nil, auth: nil) ⇒ SingleRequest
Returns a new instance of SingleRequest.
71 72 73 74 75 76 |
# File 'lib/nice_json_api.rb', line 71 def initialize(uri, method: :get, body: nil, auth: nil) @uri = URI(uri) @method = method @body = body @auth = Hash(auth) end |
Instance Method Details
#response ⇒ Object
78 79 80 81 82 |
# File 'lib/nice_json_api.rb', line 78 def response Net::HTTP.start(@uri.hostname, @uri.port, use_ssl: ssl?) do |http| http.request(req) end end |