lib/locomotive/mounter/reader/api/content_entries_reader.rb
# Filter the attributes coming directly from an API call.
#
# @param [ Object ] content_type The content type
# @param [ Hash ] attributes The attributes of the content entry
#
# @return [ Object] The attributes understandable by the content entry
#
Filter the attributes coming directly from an API call.
Filter the attributes coming directly from an API call .
def filter_attributes(content_type, original_attributes)
            attributes = original_attributes.clone.keep_if { |k, v| %w(_id _slug seo_title meta_keywords meta_description _position _visible created_at updated_at).include?(k) }
            content_type.fields.each do |field|
              value = (case field.type
              when
                original_attributes[field.name]
              when :text
                replace_urls_by_content_assets(original_attributes[field.name])
              when :select
                field.find_select_option(original_attributes[field.name]).try(:name)
              when :date
                original_attributes["formatted_#{field.name}"]
              when :file
                retrieve_file_path(content_type, field, original_attributes)
              when :has_many
                nil
              else
                original_attributes[field.name]
              end)
              attributes[field.name] = value unless value.nil?
            end
            attributes
          end
def filter_attributes ( content_type , original_attributes ) attributes = original_attributes . clone . keep_if { | k , v | %w( _id _slug seo_title meta_keywords meta_description _position _visible created_at updated_at ) . include? ( k ) } content_type . fields . each do | field | value = ( case field . type when original_attributes [ field . name ] when :text replace_urls_by_content_assets ( original_attributes [ field . name ] ) when :select field . find_select_option ( original_attributes [ field . name ] ) . try ( :name ) when :date original_attributes [ "formatted_#{field.name}" ] when :file retrieve_file_path ( content_type , field , original_attributes ) when :has_many nil else original_attributes [ field . name ] end ) attributes [ field . name ] = value unless value . nil? end attributes end
Filter the attributes coming directly from an API call.
Filter the attributes coming directly from an API call .
# :string, :boolean, :email, :integer, :float, :tags
The attributes understandable by the content entry
The attributes understandable by the content entry
 Object
content_type
<not_specific>
original_attributes
<not_specific>
<not_specific>
attributes The attributes of the content entry
attributes The attributes of the content entry