Class: Endeca::Request
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, query = nil) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #response ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(path, query = nil) ⇒ Request
Returns a new instance of Request.
11 12 13 14 |
# File 'lib/endeca/request.rb', line 11 def initialize(path, query=nil) @path = path.strip @query = query end |
Class Method Details
.perform(path, query = nil) ⇒ Object
6 7 8 9 |
# File 'lib/endeca/request.rb', line 6 def self.perform(path, query=nil) raise RequestError, "Must provide a path" unless path new(path, query).perform end |
Instance Method Details
#perform ⇒ Object
17 18 19 20 21 |
# File 'lib/endeca/request.rb', line 17 def perform raise RequestError, endeca_error[:message] if endeca_error? Endeca.increase_metric(:request_count, 1) return response end |
#response ⇒ Object
29 30 31 |
# File 'lib/endeca/request.rb', line 29 def response @response ||= handle_response(get_response) end |
#uri ⇒ Object
33 34 35 36 37 38 |
# File 'lib/endeca/request.rb', line 33 def uri return @uri if @uri path_query = query_string @uri = path_query ? "#{@path}?#{path_query}" : @path end |