Class: AssemblaService

Inherits:
Service
  • Object
show all
Includes:
HTTParty
Defined in:
app/models/project_services/assembla_service.rb

Overview

Schema Information

Table name: services

id                    :integer          not null, primary key
type                  :string
title                 :string
project_id            :integer
created_at            :datetime         not null
updated_at            :datetime         not null
active                :boolean          not null
properties            :text
template              :boolean          default(FALSE)
push_events           :boolean          default(TRUE)
issues_events         :boolean          default(TRUE)
merge_requests_events :boolean          default(TRUE)
tag_push_events       :boolean          default(TRUE)
note_events           :boolean          default(TRUE), not null
build_events          :boolean          default(FALSE), not null
category              :string           default("common"), not null
default               :boolean          default(FALSE)
wiki_page_events      :boolean          default(TRUE)

Instance Method Summary collapse

Methods inherited from Service

#activated?, #async_execute, available_services_names, boolean_accessor, #can_test?, #category, create_from_template, #help, #initialize_properties, #issue_tracker?, prop_accessor, #reset_updated_properties, #template?, #test, #updated_properties

Instance Method Details

#descriptionObject


35
36
37
# File 'app/models/project_services/assembla_service.rb', line 35

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

#execute(data) ⇒ Object


54
55
56
57
58
59
# File 'app/models/project_services/assembla_service.rb', line 54

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

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

#fieldsObject


43
44
45
46
47
48
# File 'app/models/project_services/assembla_service.rb', line 43

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

#supported_eventsObject


50
51
52
# File 'app/models/project_services/assembla_service.rb', line 50

def supported_events
  %w(push)
end

#titleObject


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

def title
  'Assembla'
end

#to_paramObject


39
40
41
# File 'app/models/project_services/assembla_service.rb', line 39

def to_param
  'assembla'
end