lib/aliyun_green/text.rb in aliyun_green-0.1.1 vs lib/aliyun_green/text.rb in aliyun_green-0.1.3
- old
+ new
@@ -1,24 +1,37 @@
module AliyunGreen
module Text
- def self.scan(content, data_id = nil)
- tasks = [
- {
- dataId: data_id,
- content: content
- }
- ]
+ class << self
+ def scan(content, data_id = nil)
+ tasks = [
+ {
+ dataId: data_id,
+ content: content,
+ },
+ ]
- response = AliyunGreen.client.post('/green/text/scan', tasks)
+ response = AliyunGreen.client.post("/green/text/scan", build_payload(tasks))
- response
- end
+ response
+ end
- def self.bulk_scan
- # TODO
+ def bulk_scan
+ # TODO
+ end
+
+ def feedback
+ # TODO
+ end
+
+ private
+
+ def build_payload(tasks)
+ payload = {
+ bizType: "default",
+ scenes: ["antispam"],
+ tasks: tasks,
+ }
+ payload
+ end
end
-
- def self.feedback
- # TODO
- end
end
-end
\ No newline at end of file
+end