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.
178 179 180 |
# File 'lib/checkoff/internal/search_url/simple_param_converter.rb', line 178 def initialize(simple_url_params:) @simple_url_params = simple_url_params end |
Instance Method Details
#convert ⇒ Hash<String, String>
Returns the converted params.
183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/checkoff/internal/search_url/simple_param_converter.rb', line 183 def convert out = simple_url_params.to_a.flat_map do |key, values| convert_arg(key, values).each_slice(2).to_a end.to_h 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 |