Skip to content

Commit

Permalink
Adds support for more complex queries using Order.search
Browse files Browse the repository at this point in the history
  • Loading branch information
allolex committed Jan 1, 2013
1 parent 9efd14c commit 0ac8285
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/nacre/api/order_service_resources/order_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.connection

def results
begin
uri = "#{@search_url}#{@query}?#{@params}"
uri = build_uri @search_url, @query, @params
response = self.class.connection.get(uri)
rescue
raise "Error in response: #{response.try(:body).try(:inspect)}\n#{connection.inspect}"
Expand All @@ -28,6 +28,11 @@ def results

private

def build_uri search_url, query, params
formatted_query = query.nil? ? '' : URI.escape(query + '&')
"#{search_url}?#{formatted_query}#{params}"
end

def build_params args
list = []
args.each_pair do |param,value|
Expand Down

0 comments on commit 0ac8285

Please sign in to comment.