@@ -15,7 +15,7 @@ class HcaAzulClient
1515 MANIFEST_FORMATS = %w[ compact full terra.bdbag terra.pfb curl ] . freeze
1616
1717 # maximum number of results to return
18- MAX_RESULTS = 80
18+ MAX_RESULTS = 75
1919
2020 # maximum length of query string (in characters) for requests
2121 MAX_QUERY_LENGTH = 8192
@@ -184,8 +184,9 @@ def catalogs
184184 # - (ArgumentError) => if catalog is not in self.all_catalogs
185185 def projects ( catalog : nil , query : { } , size : MAX_RESULTS )
186186 base_path = "#{ api_root } /index/projects?size=#{ size } "
187+ base_path += "&filters=#{ format_hash_as_query_string ( query ) } "
187188 path = append_catalog ( base_path , catalog )
188- process_api_request ( :post , path , payload : create_query_filters ( query ) )
189+ process_api_request ( :get , path )
189190 end
190191
191192 # simulate OR logic by splitting project queries on facet and joining results
@@ -280,10 +281,10 @@ def project_manifest_link(project_id, catalog: nil, format: 'compact')
280281 # - (Hash) => List of files matching query
281282 def files ( catalog : nil , query : { } , size : MAX_RESULTS )
282283 base_path = "#{ api_root } /index/files?size=#{ size } "
283- payload = create_query_filters ( query )
284+ base_path += "&filters= #{ format_hash_as_query_string ( query ) } "
284285 path = append_catalog ( base_path , catalog )
285286 # make API request, but fold in project information to each result so that this is preserved for later use
286- raw_results = process_api_request ( :post , path , payload : ) [ 'hits' ]
287+ raw_results = process_api_request ( :get , path ) [ 'hits' ]
287288 results = [ ]
288289 raw_results . each do |result |
289290 files = result [ 'files' ]
@@ -404,6 +405,19 @@ def merge_query_objects(*query_objects)
404405 merged_query
405406 end
406407
408+ # take a Hash/JSON object and format as a query string parameter
409+ #
410+ # * *params*
411+ # - +query_params+ (Hash) => Hash of query parameters
412+ #
413+ # * *returns*
414+ # - (String) => URL-encoded string version of query parameters
415+ def format_hash_as_query_string ( query_params )
416+ # replace Ruby => assignment operators with JSON standard colons (:)
417+ sanitized_params = query_params . to_s . gsub ( /=>/ , ':' )
418+ CGI . escape ( sanitized_params )
419+ end
420+
407421 # create a query filter object to use in a request body
408422 #
409423 # * *params*
0 commit comments