Sha256: e8a105190323e803851684f2965a837e8500447aa5b8892357a1e941cc4b6752
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
module Locomotive module API module Forms class SiteForm < BaseForm attrs :name, :handle, :robots_txt, :domains, :routes, :url_redirections, :timezone_name, :picture, :private_access, :password, :asset_host attrs :metafields_schema, :metafields, :metafields_ui attrs :locales, :prefix_default_locale, :bypass_browser_locale attrs :seo_title, :meta_keywords, :meta_description, localized: true attrs :cache_enabled, :cache_control, :cache_vary attrs :sections_content attrs :overwrite_same_content_assets attrs :allow_dots_in_slugs # Make sure locales and domains are in arrays. def locales [*@locales] end def domains [*@domains] end ## Custom setters ## def timezone=(value) self.timezone_name = value end def sections_content=(value) set_attribute(:sections_content, value.is_a?(String) ? parse_json(value, {}) : value) end def routes=(value) set_attribute(:routes, value.is_a?(String) ? parse_json(value, []) : value) end private def parse_json(string, default_value = nil) JSON.parse(string) rescue default_value end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems