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.



14
15
16
17
# File 'lib/predictionio/async_request.rb', line 14

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

Instance Attribute Details

#paramsObject (readonly)

Query parameters, or form data.



10
11
12
# File 'lib/predictionio/async_request.rb', line 10

def params
  @params
end

#pathObject (readonly)

The path portion of the request URI.



7
8
9
# File 'lib/predictionio/async_request.rb', line 7

def path
  @path
end

Instance Method Details

#qpathObject

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



20
21
22
# File 'lib/predictionio/async_request.rb', line 20

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