Sha256: b14d44b083f37434ec1f29c7c6fc8d4001cba6da22ae494d8e2544cbe562c470

Contents?: true

Size: 673 Bytes

Versions: 2

Compression:

Stored size: 673 Bytes

Contents

require_dependency "cadenero/application_controller"

module Cadenero
  module V1
    class AccountsController < Cadenero::ApplicationController
      def create
        @account = Cadenero::V1::Account.create_with_owner(params[:account])
        if @account.valid?
          force_authentication!(@account.owner)
          @account.create_schema
          @account.ensure_authentication_token!
          data = {
            account_id: @account.id,
            auth_token: @account.authentication_token
          }
          render json: data, status: 201
        else
          render json: {errors: @account.errors}, status: 422
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cadenero-0.0.2.a app/controllers/cadenero/v1/accounts_controller.rb
cadenero-0.0.1 app/controllers/cadenero/v1/accounts_controller.rb