Class: ApiEngineBase::Inbox::MessageBlastController

Inherits:
ApplicationController show all
Includes:
SchemaHelper
Defined in:
app/controllers/api_engine_base/inbox/message_blast_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::AUTHENTICATION_EXPIRE_HEADER, ApplicationController::AUTHENTICATION_HEADER, ApplicationController::AUTHENTICATION_WITH_RESET

Instance Method Summary collapse

Methods included from SchemaHelper

#invalid_arguments!, #schema_succesful!

Methods inherited from ApplicationController

#authenticate_user!, #authenticate_user_without_email_verification!, #authorize_user!, #current_user, #safe_boolean

Instance Method Details

#blastObject

GET /inbox/blast/:id



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/api_engine_base/inbox/message_blast_controller.rb', line 18

def blast
  result = ApiEngineBase::InboxService::Blast::Retrieve.(id: params[:id].to_i)
  if result.success?
    schema = result.message_blast
    status = 200
    schema_succesful!(status:, schema:)
  else
    invalid_arguments!(
      status: 400,
      message: result.msg,
      argument_object: result.invalid_argument_hash,
      schema: ApiEngineBase::Schema::PlainText::LoginRequest,
    )
  end
end

#createObject

POST /inbox/blast



35
36
37
# File 'app/controllers/api_engine_base/inbox/message_blast_controller.rb', line 35

def create
  upsert
end

#deleteObject

DELETE /inbox/blast/:id



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/api_engine_base/inbox/message_blast_controller.rb', line 45

def delete
  result = ApiEngineBase::InboxService::Blast::Delete.(id: params[:id].to_i)
  if result.success?
    schema = result.message
    status = 200
    render :json, { id: params[:id], msg: "Message Blast message deleted" }
  else
    invalid_arguments!(
      status: 400,
      message: result.msg,
      argument_object: result.invalid_argument_hash,
      schema: ApiEngineBase::Schema::PlainText::LoginRequest,
    )
  end
end

#metadataObject

GET /inbox/blast



12
13
14
15
# File 'app/controllers/api_engine_base/inbox/message_blast_controller.rb', line 12

def 
  result = ApiEngineBase::InboxService::Blast::Metadata.(id: params[:id].to_i)
  schema_succesful!(status: 200, schema: result.)
end

#modifyObject

PATCH /inbox/blast/:id



40
41
42
# File 'app/controllers/api_engine_base/inbox/message_blast_controller.rb', line 40

def modify
  upsert(id: params[:id].to_i)
end