gitlab-org--gitlab-foss/app/services/user_agent_detail_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
580 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
class UserAgentDetailService
def initialize(spammable:, spam_params:)
@spammable = spammable
@spam_params = spam_params
end
def create
unless spam_params&.user_agent && spam_params&.ip_address
messasge = 'Skipped UserAgentDetail creation because necessary spam_params were not provided'
return ServiceResponse.success(message: messasge)
end
2016-08-09 13:43:47 -04:00
spammable.create_user_agent_detail(user_agent: spam_params.user_agent, ip_address: spam_params.ip_address)
end
private
attr_reader :spammable, :spam_params
end