Class: AssemblaService

Inherits:
Service show all
Defined in:
app/models/project_services/assembla_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, #help, #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

Methods included from ProjectServicesLoggable

#build_message, #log_error, #log_info, #logger

Methods inherited from ApplicationRecord

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_eventsObject


26
27
28
# File 'app/models/project_services/assembla_service.rb', line 26

def self.supported_events
  %w(push)
end

.to_paramObject


15
16
17
# File 'app/models/project_services/assembla_service.rb', line 15

def self.to_param
  'assembla'
end

Instance Method Details

#descriptionObject


11
12
13
# File 'app/models/project_services/assembla_service.rb', line 11

def description
  'Project Management Software (Source Commits Endpoint)'
end

#execute(data) ⇒ Object


30
31
32
33
34
35
# File 'app/models/project_services/assembla_service.rb', line 30

def execute(data)
  return unless supported_events.include?(data[:object_kind])

  url = "https://atlas.assembla.com/spaces/#{subdomain}/github_tool?secret_key=#{token}"
  Gitlab::HTTP.post(url, body: { payload: data }.to_json, headers: { 'Content-Type' => 'application/json' })
end

#fieldsObject


19
20
21
22
23
24
# File 'app/models/project_services/assembla_service.rb', line 19

def fields
  [
    { type: 'text', name: 'token', placeholder: '', required: true },
    { type: 'text', name: 'subdomain', placeholder: '' }
  ]
end

#titleObject


7
8
9
# File 'app/models/project_services/assembla_service.rb', line 7

def title
  'Assembla'
end