Sha256: aa7fcc6cfd32e3df05d895198ca1e7fb20e62f0a2cc5eee55041b441c1c5e584

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

module Swat
  module Api
    class RevisionsController < Swat::ApplicationController
      before_filter :parse_revision_options, only: [ :show, :set_name ]


      def index
        render json: revisions
      end

      def show
        render json: FullRevision.revision_json(@options)
      end

      def set_name
        revision = Revision.take(@options)
        revision.update_field(:name, params[:name])
        render json: { success: true }
      end

      private

      def revisions
        FullRevision.revisions_json
      end

      def parse_revision_options
        @options = params[:json_params] ? HashWithIndifferentAccess[JSON.parse(params[:json_params])] : params
        @options[:time] = @options[:time].to_i if @options[:time]
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sw2at-ui-0.0.12 app/controllers/swat/api/revisions_controller.rb
sw2at-ui-0.0.11 app/controllers/swat/api/revisions_controller.rb