Class: TicketGroupLabelsService

Inherits:
ApplicationService show all
Defined in:
app/services/ticket_group_labels_service.rb

Overview

Service class that retrieves custom labels for a set of TicketGroups

Instance Attribute Summary

Attributes inherited from ApplicationService

#object

Instance Method Summary collapse

Methods inherited from ApplicationService

#execute, #execute!

Constructor Details

#initialize(ticket_group_ids) ⇒ TicketGroupLabelsService

Initializes the service with a set of TicketGroup IDs

Parameters:

  • ticket_group_ids (Array<Integer>)

    an array of TicketGroup IDs



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

def initialize(ticket_group_ids)
  @ticket_group_ids = ticket_group_ids
end

Instance Method Details

#cache_keyObject



17
18
19
# File 'app/services/ticket_group_labels_service.rb', line 17

def cache_key
  collections.cache_key
end

#callArray<Hash>

Retrieves custom labels for each TicketGroup

Returns:

  • (Array<Hash>)

    an array of hashes containing TicketGroup IDs and their associated custom labels



13
14
15
# File 'app/services/ticket_group_labels_service.rb', line 13

def call
  collections.map { |ticket_group| ticket_group_custom_labels(ticket_group) }
end