Class: StatusMessageCreationService

Inherits:
Object
  • Object
show all
Defined in:
app/services/status_message_creation_service.rb

Defined Under Namespace

Classes: BadAspectsIDs, MissingContent

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ StatusMessageCreationService

Returns a new instance of StatusMessageCreationService.


6
7
8
# File 'app/services/status_message_creation_service.rb', line 6

def initialize(user)
  @user = user
end

Instance Method Details

#create(params) ⇒ Object


10
11
12
13
14
15
16
17
18
19
# File 'app/services/status_message_creation_service.rb', line 10

def create(params)
  validate_content(params)

  build_status_message(params).tap do |status_message|
    load_aspects(params[:aspect_ids]) unless status_message.public?
    add_attachments(status_message, params)
    status_message.save
    process(status_message, params[:services])
  end
end