Class: Copyleaks::CopyleaksURLSubmissionModel
- Inherits:
-
CopyleaksSubmissionModel
- Object
- CopyleaksSubmissionModel
- Copyleaks::CopyleaksURLSubmissionModel
- Defined in:
- lib/copyleaks/models/submissions/url_submission_model.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from CopyleaksSubmissionModel
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(url, properties) ⇒ CopyleaksURLSubmissionModel
constructor
A new instance of CopyleaksURLSubmissionModel.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(url, properties) ⇒ CopyleaksURLSubmissionModel
Returns a new instance of CopyleaksURLSubmissionModel.
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
#url ⇒ Object (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(*) as_json(*).to_json(*) end |