Class: Copyleaks::SubmissionWebhooks
- Inherits:
-
Object
- Object
- Copyleaks::SubmissionWebhooks
- Defined in:
- lib/copyleaks/models/submissions/properties/webhooks.rb
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(status, newResult = nil, statusHeaders = nil, newResultHeaders = nil) ⇒ SubmissionWebhooks
constructor
A new instance of SubmissionWebhooks.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(status, newResult = nil, statusHeaders = nil, newResultHeaders = nil) ⇒ SubmissionWebhooks
Returns a new instance of SubmissionWebhooks.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/copyleaks/models/submissions/properties/webhooks.rb', line 30 def initialize(status, newResult = nil, statusHeaders = nil, newResultHeaders = nil) unless status.instance_of? String raise 'Copyleaks::SubmissionWebhooks - status - status must be of type String' end unless newResult.nil? || newResult.instance_of?(String) raise 'Copyleaks::SubmissionWebhooks - newResult - newResult must be of type String' end unless header_format_valid?(statusHeaders) raise 'Copyleaks::SubmissionWebhooks - statusHeaders - statusHeaders must be an Array of String Array pairs' end unless header_format_valid?(newResultHeaders) raise 'Copyleaks::SubmissionWebhooks - newResultHeaders - newResultHeaders must be an Array of String Array pairs' end @newResult = newResult @status = status @statusHeaders = statusHeaders @newResultHeaders = newResultHeaders end |
Instance Method Details
#as_json(*_args) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/copyleaks/models/submissions/properties/webhooks.rb', line 50 def as_json(*_args) { newResult: @newResult, status: @status, statusHeaders: @statusHeaders, newResultHeaders: @newResultHeaders }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
59 60 61 |
# File 'lib/copyleaks/models/submissions/properties/webhooks.rb', line 59 def to_json(*) as_json(*).to_json(*) end |