Class: Labels::FindOrCreateService

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

Instance Method Summary collapse

Constructor Details

#initialize(current_user, parent, params = {}) ⇒ FindOrCreateService

Returns a new instance of FindOrCreateService.


5
6
7
8
9
10
# File 'app/services/labels/find_or_create_service.rb', line 5

def initialize(current_user, parent, params = {})
  @current_user = current_user
  @parent = parent
  @available_labels = params.delete(:available_labels)
  @params = params.dup.with_indifferent_access
end

Instance Method Details

#execute(skip_authorization: false, find_only: false) ⇒ Object


12
13
14
15
# File 'app/services/labels/find_or_create_service.rb', line 12

def execute(skip_authorization: false, find_only: false)
  @skip_authorization = skip_authorization
  find_or_create_label(find_only: find_only)
end