Class: GemnasiumService

Inherits:
Service
  • Object
show all
Defined in:
app/models/project_services/gemnasium_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/gemnasium_service.rb', line 35

def description
  'Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities.'
end

#execute(data) ⇒ Object


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

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

  Gemnasium::GitlabService.execute(
    ref: data[:ref],
    before: data[:before],
    after: data[:after],
    token: token,
    api_key: api_key,
    repo: project.repository.path_to_repo
  )
end

#fieldsObject


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

def fields
  [
    { type: 'text', name: 'api_key', placeholder: 'Your personal API KEY on gemnasium.com ' },
    { type: 'text', name: 'token', placeholder: 'The project\'s slug on gemnasium.com' }
  ]
end

#supported_eventsObject


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

def supported_events
  %w(push)
end

#titleObject


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

def title
  'Gemnasium'
end

#to_paramObject


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

def to_param
  'gemnasium'
end