Module: Poms::Api::Search
- Defined in:
- lib/poms/api/search.rb
Overview
Map search parameters to POMS specific format
Constant Summary collapse
- TIME_PARAMS =
{ starts_at: 'begin', ends_at: 'end' }.freeze
Class Method Summary collapse
- .build(options) ⇒ Object
-
.empty ⇒ Object
Helper function for returning and empty body.
Class Method Details
.build(options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/poms/api/search.rb', line 19 def build() return {} if .empty? all = .map do |key, value| case key when :starts_at, :ends_at time_params(key, value) when :type { 'searches' => { 'types' => value } } end end all.reduce(&:deep_merge) end |
.empty ⇒ Object
Helper function for returning and empty body.
15 16 17 |
# File 'lib/poms/api/search.rb', line 15 def empty {} end |