Sha256: 696619423d1f2a2b3b58ded826d4a88a1c33d3dd511df44c348a9f60edba51e4

Contents?: true

Size: 799 Bytes

Versions: 9

Compression:

Stored size: 799 Bytes

Contents

module Locomotive::Wagon

  class PushSiteCommand < PushBaseCommand

    def entities
      [repositories.site.first]
    end

    def decorate(entity)
      UpdateSiteDecorator.new(entity)
    end

    def persist(decorated_entity)
      _attributes = decorated_entity.to_hash

      # push the picture only if there is no existing remote picture
      _attributes.delete(:picture) if remote_site['picture_url'].present?

      # push the locales as long as there is no content on the remote site yet
      _attributes.delete(:locales) if remote_site.edited?

      if _attributes.present?
        api_client.current_site.update(_attributes)
      else
        raise SkipPersistingException.new
      end
    end

    def label_for(decorated_entity)
      decorated_entity.name
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotivecms_wagon-2.0.0 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc8 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc7 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc6 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc5 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc4 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc3 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc2 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb
locomotivecms_wagon-2.0.0.rc1 lib/locomotive/wagon/commands/push_sub_commands/push_site_command.rb