Class: Copyleaks::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint:, isHealthy:, httpStatusCode:) ⇒ Task

Returns a new instance of Task.

Parameters:

  • endpoint (String)
    • The endpoint address of the export task.

  • isHealthy (Boolean)
    • This flag gives an indication whether the scan was completed without internal errors on the Copyleaks side.

  • httpStatusCode (Integer)
    • The status code reported by the customer servers. If the tasks.isHealthy is equal to false - this field will be null.



27
28
29
30
31
32
33
34
35
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb', line 27

def initialize(endpoint:, isHealthy:, httpStatusCode:)
  raise 'Copyleaks::Task - endpoint must be a String' unless endpoint.is_a?(String)
  raise 'Copyleaks::Task - isHealthy must be a Boolean' unless [true, false].include?(isHealthy)
  raise 'Copyleaks::Task - httpStatusCode must be an Integer' unless httpStatusCode.is_a?(Integer)

  @endpoint = endpoint
  @isHealthy = isHealthy
  @httpStatusCode = httpStatusCode
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb', line 22

def endpoint
  @endpoint
end

#httpStatusCodeObject (readonly)

Returns the value of attribute httpStatusCode.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb', line 22

def httpStatusCode
  @httpStatusCode
end

#isHealthyObject (readonly)

Returns the value of attribute isHealthy.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb', line 22

def isHealthy
  @isHealthy
end

Instance Method Details

#as_json(*_args) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb', line 37

def as_json(*_args)
  {
    endpoint: @endpoint,
    isHealthy: @isHealthy,
    httpStatusCode: @httpStatusCode
  }
end

#to_json(*options) ⇒ Object



45
46
47
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb', line 45

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