Class: Checkoff::Internal::SearchUrl::SimpleParamConverter
- Inherits:
-
Object
- Object
- Checkoff::Internal::SearchUrl::SimpleParamConverter
- Defined in:
- lib/checkoff/internal/search_url/simple_param_converter.rb
Overview
Convert simple parameters - ones where the param name itself doesn’t encode any parameters’
Instance Method Summary collapse
-
#convert ⇒ Hash{String => String}
The converted params.
-
#initialize(simple_url_params:) ⇒ SimpleParamConverter
constructor
A new instance of SimpleParamConverter.
Constructor Details
#initialize(simple_url_params:) ⇒ SimpleParamConverter
Returns a new instance of SimpleParamConverter.
191 192 193 |
# File 'lib/checkoff/internal/search_url/simple_param_converter.rb', line 191 def initialize(simple_url_params:) @simple_url_params = simple_url_params end |
Instance Method Details
#convert ⇒ Hash{String => String}
Returns the converted params.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/checkoff/internal/search_url/simple_param_converter.rb', line 196 def convert # @type [Array<Array(String, String)>] arr_of_tuples = simple_url_params.to_a.flat_map do |key, values| # @type entry = convert_arg(key, values).each_slice(2).to_a entry end # @type [Hash{String => String}] out = T.cast(arr_of_tuples.to_h, T::Hash[String, String]) unless out.include? 'sort_by' # keep results consistent between calls; API using default # sort_by does not seem to be. out['sort_by'] = 'created_at' end out end |