def find_suitable_api_call(possible_apis, params)
      apis_with_params = possible_apis.map do |api|
        [api, self.class.params_in_path(api['api_url'])]
      end.sort_by { |api, url_params| [-1 * url_params.count, api['api_url']] }

      suitable_api = apis_with_params.find do |api, url_params|
        url_params.all? { |url_param| params.keys.map(&:to_s).include?(url_param) }
      end

      suitable_api ||= apis_with_params.last
      return suitable_api.first
    end
def find_suitable_api_call(possible_apis, params)
      apis_with_params = possible_apis.map do |api|
        [api, self.class.params_in_path(api['api_url'])]
      end.sort_by { |api, url_params| [-1 * url_params.count, api['api_url']] }

      suitable_api = apis_with_params.find do |api, url_params|
        url_params.all? { |url_param| params.keys.map(&:to_s).include?(url_param) }
      end

      suitable_api ||= apis_with_params.last
      return suitable_api.first
    end
@param possible_apis [Array] Array of hasahs in form of
   [{:api_url => '/path1', :http_method => 'GET'}, {...}]
 @param params [Hash] enterred params
 @return api that suits the enterred params mosts

 Given this paths:
   1. +/comments+
   2. +/users/:user_id/comments+
   3. +/users/:user_id/posts/:post_id/comments+

 If +:user_id+ and +:post_id+ is pecified, the third path is
 used. If only +:user_id+ is specified, the second one is used.
 The selection defaults to the path with the least number of
 incuded params in alphanumeric order.