Class: Copyleaks::CopyleaksURLSubmissionModel

Inherits:
CopyleaksSubmissionModel show all
Defined in:
lib/copyleaks/models/submissions/url_submission_model.rb

Instance Attribute Summary collapse

Attributes inherited from CopyleaksSubmissionModel

#properties

Instance Method Summary collapse

Constructor Details

#initialize(url, properties) ⇒ CopyleaksURLSubmissionModel

Returns a new instance of CopyleaksURLSubmissionModel.

Parameters:

  • url (String)

    The url to be scanned

  • properties (SubmissionProperties)

    Check inner properties for more details.



30
31
32
33
34
35
36
37
38
# File 'lib/copyleaks/models/submissions/url_submission_model.rb', line 30

def initialize(url, properties)
  raise 'Copyleaks::CopyleaksURLSubmissionModel - url - url must be of type String' unless url.instance_of?(String)
  unless properties.instance_of?(SubmissionProperties)
    raise 'Copyleaks::CopyleaksURLSubmissionModel - properties - properties must be of type SubmissionProperties'
  end

  super(properties)
  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



26
27
28
# File 'lib/copyleaks/models/submissions/url_submission_model.rb', line 26

def url
  @url
end

Instance Method Details

#as_json(*_args) ⇒ Object



40
41
42
43
44
45
# File 'lib/copyleaks/models/submissions/url_submission_model.rb', line 40

def as_json(*_args)
  {
    properties: @properties,
    url: @url
  }.select { |_k, v| !v.nil? }
end

#to_json(*options) ⇒ Object



47
48
49
# File 'lib/copyleaks/models/submissions/url_submission_model.rb', line 47

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