Class: Copyleaks::NewResultsRepositories

Inherits:
SharedResultsModel show all
Defined in:
lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb

Instance Attribute Summary collapse

Attributes inherited from SharedResultsModel

#id, #introduction, #matchedWords, #scanId, #title

Instance Method Summary collapse

Constructor Details

#initialize(repositoryId:, metadata:) ⇒ NewResultsRepositories

Returns a new instance of NewResultsRepositories.

Parameters:

  • repositoryId (String)
    • The repository Id that has the result.

  • metadata (RepositoryMetadata)
    • Metadata object



26
27
28
29
30
31
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb', line 26

def initialize(repositoryId:, metadata:)
  raise 'Copyleaks::NewResultsRepositories - repositoryId must be a String' unless repositoryId.is_a?(String)
  super(metadata: )

  @repositoryId = repositoryId
end

Instance Attribute Details

#repositoryIdObject (readonly)

Returns the value of attribute repositoryId.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb', line 22

def repositoryId
  @repositoryId
end

Instance Method Details

#as_json(*_args) ⇒ Object



38
39
40
41
42
43
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb', line 38

def as_json(*_args)
  {
    repositoryId: @repositoryId,
    metadata: 
  }
end

#metadataObject

Override metadata getter to return a RepositoryMetadata type explicitly



34
35
36
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb', line 34

def 
  super 
end

#to_json(*options) ⇒ Object



45
46
47
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb', line 45

def to_json(*options)
  as_json(*options).to_json(*options)
end