app/controllers/maestrano/synchronizations_controller.rb in maestrano-connector-rails-1.2.3 vs app/controllers/maestrano/synchronizations_controller.rb in maestrano-connector-rails-1.3.0
- old
+ new
@@ -1,10 +1,10 @@
class Maestrano::SynchronizationsController < Maestrano::Rails::WebHookController
def show
uid = params[:id]
organization = Maestrano::Connector::Rails::Organization.find_by_uid(uid)
- return render json: {errors: {message: "Organization not found", code: 404}}, status: :not_found unless organization
+ return render json: {errors: [{message: "Organization not found", code: 404}]}, status: :not_found unless organization
h = {
group_id: organization.uid,
sync_enabled: organization.sync_enabled
}
@@ -23,19 +23,19 @@
def create
uid = params[:group_id]
opts = params[:opts] || {}
organization = Maestrano::Connector::Rails::Organization.find_by_uid(uid)
- return render json: {errors: {message: "Organization not found", code: 404}}, status: :not_found unless organization
+ return render json: {errors: [{message: "Organization not found", code: 404}]}, status: :not_found unless organization
Maestrano::Connector::Rails::SynchronizationJob.perform_later(organization, opts.with_indifferent_access)
head :created
end
def toggle_sync
uid = params[:group_id]
organization = Maestrano::Connector::Rails::Organization.find_by_uid(uid)
- return render json: {errors: {message: "Organization not found", code: 404}}, status: :not_found unless organization
+ return render json: {errors: [{message: "Organization not found", code: 404}]}, status: :not_found unless organization
organization.toggle(:sync_enabled)
organization.save
render json: {sync_enabled: organization.sync_enabled}