Class: Copyleaks::ModerationsModel
- Inherits:
-
Object
- Object
- Copyleaks::ModerationsModel
- Defined in:
- lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text: Text.new) ⇒ ModerationsModel
constructor
A new instance of ModerationsModel.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(text: Text.new) ⇒ ModerationsModel
Returns a new instance of ModerationsModel.
8 9 10 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb', line 8 def initialize(text: Text.new) @text = text end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb', line 5 def text @text end |
Class Method Details
.from_json(json_string) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb', line 19 def self.from_json(json_string) data = JSON.parse(json_string, symbolize_names: true) new( text: data[:text] ? Text.from_json(data[:text].to_json) : nil ) end |
Instance Method Details
#to_json(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb', line 12 def to_json( = {}) { text: @text ? JSON.parse(@text.to_json) : nil }.to_json() end |