@@ -6,10 +6,9 @@ module Search
66 # Twingly Search API query
77 #
88 # @attr [String] search_query the search query.
9- # @attr [String] language language to restrict the query to.
109 # @attr [Client] client the client that this query is connected to.
1110 class Query
12- attr_accessor :search_query , :language , : client
11+ attr_accessor :search_query , :client
1312
1413 # @deprecated Please use {#search_query} instead
1514 def pattern
@@ -23,6 +22,18 @@ def pattern=(search_query)
2322 @search_query = search_query
2423 end
2524
25+ # @deprecated Please use {#search_query} instead
26+ def language
27+ warn "[DEPRECATION] `language` is deprecated. Please use `search_query` instead."
28+ @language
29+ end
30+
31+ # @deprecated Please use {#search_query=} instead
32+ def language = ( language_code )
33+ warn "[DEPRECATION] `language=` is deprecated. Please use `search_query=` instead."
34+ @language = language_code
35+ end
36+
2637 # @return [Time] the time that was set with {#start_time=}.
2738 def start_time
2839 @start_time
@@ -66,7 +77,7 @@ def url_parameters
6677 # @return [Hash] the request parameters.
6778 def request_parameters
6879 full_search_query = search_query . to_s . dup
69- full_search_query << " lang:#{ language } " if language
80+ full_search_query << " lang:#{ @ language} " unless @ language. to_s . empty?
7081 full_search_query << " start-date:#{ formatted_start_date } " if start_time
7182 full_search_query << " end-date:#{ formatted_end_date } " if end_time
7283
0 commit comments