Class: FlowdockService

Inherits:
Service
  • Object
show all
Defined in:
app/models/project_services/flowdock_service.rb

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/flowdock_service.rb', line 35

def description
  'Flowdock is a collaboration web app for technical teams.'
end

#execute(data) ⇒ Object


53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/models/project_services/flowdock_service.rb', line 53

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

  Flowdock::Git.post(
    data[:ref],
    data[:before],
    data[:after],
    token: token,
    repo: project.repository.path_to_repo,
    repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}",
    commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s",
    diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s",
  )
end

#fieldsObject


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

def fields
  [
    { type: 'text', name: 'token', placeholder: 'Flowdock Git source token' }
  ]
end

#supported_eventsObject


49
50
51
# File 'app/models/project_services/flowdock_service.rb', line 49

def supported_events
  %w(push)
end

#titleObject


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

def title
  'Flowdock'
end

#to_paramObject


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

def to_param
  'flowdock'
end