Sha256: 7a7b3c47a856c72e41a9b66540163ebaa8f00a289dd18ae2bd2379be6dddc088

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Locomotive
  module Api
    class MyAccountController < BaseController

      skip_load_and_authorize_resource

      skip_before_filter :require_site, :set_locale, :set_current_thread_variables

      skip_before_filter :require_account, only: [:create]

      def show
        respond_with(current_locomotive_account)
      end

      def create
        @account = Locomotive::Account.new
        @account.from_presenter(params[:account])
        @account.save
        respond_with(@account)
      end

      def update
        current_locomotive_account.from_presenter(params[:account])
        current_locomotive_account.save
        respond_with(current_locomotive_account)
      end

      protected

      def self.description
        {
          overall: %{Manage the current account (my account)},
          actions: {
            show: {
              description: %{Return the attributes of my account},
              response: Locomotive::AccountPresenter.getters_to_hash,
              example: {
                command: %{curl 'http://mysite.com/locomotive/api/my_account.json'},
                response: %(TODO)
              }
            }
          }
        }
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 app/controllers/locomotive/api/my_account_controller.rb