Class: PredictionIO::AsyncRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/predictionio/async_request.rb

Overview

This class contains the URI path and query parameters that is consumed by PredictionIO::Connection for asynchronous HTTP requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, params = {}) ⇒ AsyncRequest

Populates the package with request URI path, and optionally query parameters or form data.


29
30
31
32
# File 'lib/predictionio/async_request.rb', line 29

def initialize(path, params = {})
  @params = params
  @path = path
end

Instance Attribute Details

#paramsObject (readonly)

Query parameters, or form data.


25
26
27
# File 'lib/predictionio/async_request.rb', line 25

def params
  @params
end

#pathObject (readonly)

The path portion of the request URI.


22
23
24
# File 'lib/predictionio/async_request.rb', line 22

def path
  @path
end

Instance Method Details

#qpathObject

Returns an URI path with query parameters encoded for HTTP GET requests.


35
36
37
# File 'lib/predictionio/async_request.rb', line 35

def qpath
  "#{@path}?#{URI::encode_www_form(@params)}"
end