Class: Copyleaks::Repositories

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

Instance Attribute Summary collapse

Attributes inherited from SharedResultsModel

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

Instance Method Summary collapse

Constructor Details

#initialize(repositoryId:, tags:, **options) ⇒ Repositories

Returns a new instance of Repositories.

Parameters:

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

  • tags (Array<Tags>)
    • Tags object array



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb', line 27

def initialize(repositoryId:, tags:, **options)
  unless repositoryId.is_a?(String)
    raise 'Copyleaks::Repositories - repositoryId must be a String'
  end

  unless tags.is_a?(Array) && tags.all? { |tag| tag.is_a?(Tags) }
    raise 'Copyleaks::Repositories - tags must be an Array of Tags'
  end

  super(**options) 

  @repositoryId = repositoryId
  @tags = tags
end

Instance Attribute Details

#repositoryIdObject (readonly)

Returns the value of attribute repositoryId.



23
24
25
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb', line 23

def repositoryId
  @repositoryId
end

#tagsObject (readonly)

Returns the value of attribute tags.



23
24
25
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb', line 23

def tags
  @tags
end

Instance Method Details

#as_json(*_args) ⇒ Object



46
47
48
49
50
51
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb', line 46

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

#metadataObject



42
43
44
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb', line 42

def 
  super 
end

#to_json(*options) ⇒ Object



53
54
55
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb', line 53

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