Module: RongCloud::Request
Overview
Handle api request, based on Ruby’s built-in Net::HTTP, support both HTTP and HTTPS
Instance Method Summary collapse
-
#request(path, params = nil, content_type = :form_data) ⇒ Hash
The parsed response represented by JSON.
Methods included from Signature
Instance Method Details
#request(path, params = nil, content_type = :form_data) ⇒ Hash
Returns the parsed response represented by JSON.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rong_cloud/request.rb', line 18 def request(path, params = nil, content_type = :form_data) uri = get_uri(path) req = initialize_request(uri, params, content_type) use_ssl = uri.scheme == 'https' timeout = RongCloud::Configuration.timeout = { use_ssl: use_ssl, open_timeout: timeout, read_timeout: timeout } res = Net::HTTP.start(uri.hostname, uri.port, ) do |http| inspect_debug_informations(req, uri, ) http.request(req) end inspect_debug_informations(res) handle_response(res) end |