Sha256: 3af37c66d8939e234724e59f13b61410133f5b80e50f87a4f712c1d2d213b2a3
Contents?: true
Size: 1.1 KB
Versions: 21
Compression:
Stored size: 1.1 KB
Contents
module Scrivito class ObjParamsParser < Struct.new(:host, :port, :context) class UnknownWidgetAction < ScrivitoError end def parse(params) params = params.deep_dup convert_params(params) params end private def convert_field_params(params, attribute_definitions) params.each_pair do |key, value| params[key] = case type = attribute_definitions[key.to_s].try(:type) when 'binary' then parse_binary_params(value) when 'html' then ContentConversion.convert_html_links(value, host, port) when 'link' then ContentConversion.convert_link(value, host, port) when 'linklist' then ContentConversion.convert_linklist_urls(value, host, port) when 'date' then DateConversion.deserialize_from_client(value) else value end end end def parse_binary_params(params) return unless params UploadedBinary.new(params) end def raise_widget_not_found_error(widget_id) raise ResourceNotFound, "Could not find Widget with id #{widget_id}" end end end
Version data entries
21 entries across 21 versions & 1 rubygems