Class: Copyleaks::AIDetectionSubmissionModel

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

Direct Known Subclasses

NaturalLanguageSubmissionModel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, sandbox = false) ⇒ AIDetectionSubmissionModel

Returns a new instance of AIDetectionSubmissionModel.

Parameters:

  • A (String)

    text string.

  • Use (Boolean)

    sandbox mode to test your integration with the Copyleaks API for free.



31
32
33
34
35
36
37
# File 'lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb', line 31

def initialize(text, sandbox = false)
  unless text.instance_of?(String)
    raise 'Copyleaks::AIDetectionSubmissionModel - text - text must be of type String'
  end
  @text = text
  @sandbox = sandbox
end

Instance Attribute Details

#sandboxObject

Returns the value of attribute sandbox.



27
28
29
# File 'lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb', line 27

def sandbox
  @sandbox
end

#textObject

Returns the value of attribute text.



27
28
29
# File 'lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb', line 27

def text
  @text
end

Instance Method Details

#as_json(*_args) ⇒ Object



39
40
41
42
43
44
# File 'lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb', line 39

def as_json(*_args)
  {
    'text' => @text,
    'sandbox' => @sandbox
  }.reject { |_, v| v.nil? }
end

#to_json(*options) ⇒ Object



46
47
48
# File 'lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb', line 46

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