lib/wcc/media/client.rb in wcc-media-client-0.4.0 vs lib/wcc/media/client.rb in wcc-media-client-0.4.1
- old
+ new
@@ -24,10 +24,14 @@
order_by
sort
target
].freeze
+ CONFIGURABLE_PARAMS = PARAMS - %w[
+ offset
+ ]
+
RESOURCES = {
'messages' => WCC::Media::Message,
'series' => WCC::Media::Series,
'speakers' => WCC::Media::Speaker,
'tags' => WCC::Media::Tag,
@@ -66,12 +70,19 @@
end
private
def extract_params(filters)
- filters.each_with_object({}) do |(k, _v), h|
+ filters.each_with_object(default_params) do |(k, _v), h|
k_s = k.to_s
h[k_s] = filters.delete(k) if PARAMS.include?(k_s)
+ end
+ end
+
+ def default_params
+ options.each_with_object({}) do |(k, v), h|
+ k = k.to_s
+ h[k] = v if CONFIGURABLE_PARAMS.include?(k)
end
end
def apply_filters(filters, expected_filters)
defaults = default_filters(expected_filters) || {}