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.
12 13 14 15 |
# File 'lib/endeca/request.rb', line 12 def initialize(path, query=nil) @path = path.strip @query = query end |
Class Method Details
.perform(path, query = nil) ⇒ Object
7 8 9 10 |
# File 'lib/endeca/request.rb', line 7 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
23 24 25 |
# File 'lib/endeca/request.rb', line 23 def response @response ||= handle_response(get_response) end |
#uri ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/endeca/request.rb', line 27 def uri return @uri if @uri @uri = URI.parse(@path) @uri.query = query_string unless !@query || @query.include?("/_/") @uri = URI.parse("#{@path}#{@query}") if @query && @query.include?("/_/") @uri end |