lib/socketlabs/injectionapi/core/http_request.rb
# Build the API request for HTTP::NET
Build the API request for HTTP::NET
Build the API request for HTTP :: NET
def build_request
          uri = URI.parse(@endpoint)
          params = [uri.host, uri.port]
          params += @proxy.values_at(:host, :port, :user, :pass) unless @proxy.empty?
          @http = Net::HTTP.new(*params)
          @http.read_timeout = @timeout
          if @endpoint.start_with?('https')
            @http.use_ssl = true
            @http.verify_mode = OpenSSL::SSL::VERIFY_PEER
          end
          net_http = Kernel.const_get('Net::HTTP::' + @request_method[:method].capitalize)
          @request = add_request_headers(net_http.new(uri.request_uri))
        end
def build_request uri = URI . parse ( @endpoint ) params = [ uri . host , uri . port ] params += @proxy . values_at ( :host , :port , :user , :pass ) unless @proxy . empty? @http = Net :: HTTP . new ( * params ) @http . read_timeout = @timeout if @endpoint . start_with? ( 'https' ) @http . use_ssl = true @http . verify_mode = OpenSSL :: SSL :: VERIFY_PEER end net_http = Kernel . const_get ( 'Net::HTTP::' + @request_method [ :method ] . capitalize ) @request = add_request_headers ( net_http . new ( uri . request_uri ) ) end
Build the API request for HTTP::NET
Build the API request for HTTP :: NET
# add uri # add proxy # add timeout # add ssl