Class: IrkerService
- Inherits:
-
Service
show all
- Defined in:
- app/models/project_services/irker_service.rb
Constant Summary
Constants inherited
from Service
Service::DEV_SERVICE_NAMES, Service::SERVICE_NAMES
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Service
#activated?, #api_field_names, #async_execute, available_services_names, available_services_types, boolean_accessor, build_from_integration, #can_test?, #category, #configurable_event_actions, #configurable_events, default_integration, dev_services_names, #editable?, #event_channel_names, event_description, #event_field, event_names, #event_names, find_or_create_templates, find_or_initialize_all, find_or_initialize_integration, #global_fields, #initialize_properties, instance_exists_for?, #issue_tracker?, #json_fields, #operating?, prop_accessor, #reset_updated_properties, services_names, services_types, #show_active_box?, supported_event_actions, #supported_events, #supports_data_fields?, #test, #to_data_fields_hash, #to_param, #to_service_hash, #updated_properties
#build_message, #log_error, #log_info, #logger
at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order
Class Method Details
.supported_events ⇒ Object
26
27
28
|
# File 'app/models/project_services/irker_service.rb', line 26
def self.supported_events
%w(push)
end
|
.to_param ⇒ Object
22
23
24
|
# File 'app/models/project_services/irker_service.rb', line 22
def self.to_param
'irker'
end
|
Instance Method Details
#description ⇒ Object
17
18
19
20
|
# File 'app/models/project_services/irker_service.rb', line 17
def description
'Send IRC messages, on update, to a list of recipients through an Irker '\
'gateway.'
end
|
#execute(data) ⇒ Object
30
31
32
33
34
35
|
# File 'app/models/project_services/irker_service.rb', line 30
def execute(data)
return unless supported_events.include?(data[:object_kind])
IrkerWorker.perform_async(project_id, channels,
colorize_messages, data, settings)
end
|
#fields ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'app/models/project_services/irker_service.rb', line 44
def fields
[
{ type: 'text', name: 'server_host', placeholder: 'localhost',
help: 'Irker daemon hostname (defaults to localhost)' },
{ type: 'text', name: 'server_port', placeholder: 6659,
help: 'Irker daemon port (defaults to 6659)' },
{ type: 'text', name: 'default_irc_uri', title: 'Default IRC URI',
help: 'A default IRC URI to prepend before each recipient (optional)',
placeholder: 'irc://irc.network.net:6697/' },
{ type: 'textarea', name: 'recipients',
placeholder: 'Recipients/channels separated by whitespaces', required: true,
help: 'Recipients have to be specified with a full URI: '\
'irc[s]://irc.network.net[:port]/#channel. Special cases: if '\
'you want the channel to be a nickname instead, append ",isnick" to ' \
'the channel name; if the channel is protected by a secret password, ' \
' append "?key=secretpassword" to the URI (Note that due to a bug, if you ' \
' want to use a password, you have to omit the "#" on the channel). If you ' \
' specify a default IRC URI to prepend before each recipient, you can just ' \
' give a channel name.' },
{ type: 'checkbox', name: 'colorize_messages' }
]
end
|
#help ⇒ Object
67
68
69
70
71
72
|
# File 'app/models/project_services/irker_service.rb', line 67
def help
' NOTE: Irker does NOT have built-in authentication, which makes it' \
' vulnerable to spamming IRC channels if it is hosted outside of a ' \
' firewall. Please make sure you run the daemon within a secured network ' \
' to prevent abuse. For more details, read: http://www.catb.org/~esr/irker/security.html.'
end
|
#settings ⇒ Object
37
38
39
40
41
42
|
# File 'app/models/project_services/irker_service.rb', line 37
def settings
{
server_host: server_host.presence || 'localhost',
server_port: server_port.presence || 6659
}
end
|
#title ⇒ Object
13
14
15
|
# File 'app/models/project_services/irker_service.rb', line 13
def title
'Irker (IRC gateway)'
end
|