Class: Ci::Catalog::ValidateResourceService

Inherits:
Object
  • Object
show all
Defined in:
app/services/ci/catalog/validate_resource_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, ref) ⇒ ValidateResourceService

Returns a new instance of ValidateResourceService.



8
9
10
11
12
# File 'app/services/ci/catalog/validate_resource_service.rb', line 8

def initialize(project, ref)
  @project = project
  @ref = ref
  @errors = []
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



6
7
8
# File 'app/services/ci/catalog/validate_resource_service.rb', line 6

def project
  @project
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
# File 'app/services/ci/catalog/validate_resource_service.rb', line 14

def execute
  check_project_readme
  check_project_description

  if errors.empty?
    ServiceResponse.success
  else
    ServiceResponse.error(message: errors.join(' , '))
  end
end