Class: Copyleaks::CopyleaksSubmissionModel

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/submission_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties) ⇒ CopyleaksSubmissionModel

Returns a new instance of CopyleaksSubmissionModel.

Parameters:



29
30
31
32
33
34
35
# File 'lib/copyleaks/models/submissions/submission_model.rb', line 29

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

  @properties = properties
end

Instance Attribute Details

#propertiesObject (readonly)

Returns the value of attribute properties.



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

def properties
  @properties
end

Instance Method Details

#as_json(*_args) ⇒ Object



37
38
39
40
41
# File 'lib/copyleaks/models/submissions/submission_model.rb', line 37

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

#to_json(*options) ⇒ Object



43
44
45
# File 'lib/copyleaks/models/submissions/submission_model.rb', line 43

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