Sha256: d96ee5593cef1d3110deaaeae073239b7902bf3e7b2bbe704c3417fe3f15b563

Contents?: true

Size: 1.69 KB

Versions: 30

Compression:

Stored size: 1.69 KB

Contents

module Locomotive
  module Api
    class CurrentSiteController < Api::BaseController

      def show
        @site = current_site
        authorize! :show, @site
        respond_with(@site)
      end

      def update
      	@site = current_site
      	authorize! :update, @site
        @site.from_presenter(params[:site])
        @site.save
      	respond_with(@site)
      end

      def destroy
        @site = current_site
        authorize! :destroy, @site
        @site.destroy
        respond_with(@site)
      end

      def self.description
        {
          overall: %{Manage the current site related to the domain name used to make the API call},
          actions: {
            show: {
              description: %{Return the attributes of the current site},
              response: Locomotive::SitePresenter.getters_to_hash,
              example: {
                command: %{curl 'http://mysite.com/locomotive/api/tokens.json'},
                response: %(TODO)
              }
            },
            update: {
              description: %{Update the current site},
              params: Locomotive::SitePresenter.setters_to_hash,
              example: {
                command: %{curl -d '...' -X UPDATE 'http://mysite.com/locomotive/api/current_site.json?auth_token=dtsjkqs1TJrWiSiJt2gg'},
                response: %(TODO)
              }
            },
            destroy: {
              description: %{Delete the current site},
              example: {
                command: %{curl -X DELETE 'http://mysite.com/locomotive/api/current_site.json?auth_token=dtsjkqs1TJrWiSiJt2gg'},
                response: %(TODO)
              }
            }
          }
        }
      end

    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.6 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.6.rc2 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.6.rc1 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.5 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.4 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.3 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.2 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.1 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.0 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.0.rc3 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.0.rc2 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.5.0.rc1 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.4.1 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.4.0 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.3.1 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.3.0 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.2.3 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.2.2 app/controllers/locomotive/api/current_site_controller.rb
locomotive_cms-2.2.1 app/controllers/locomotive/api/current_site_controller.rb