Sha256: 5c7b482a54f3873a238589cf27f91a31e498fddd7229f8ce3d3aeb82c7529cb4

Contents?: true

Size: 614 Bytes

Versions: 2

Compression:

Stored size: 614 Bytes

Contents

module AliyunGreen
  module Text
    class << self
      def scan(content, data_id = nil)
        tasks = [
          {
            dataId: data_id,
            content: content,
          },
        ]

        response = AliyunGreen.client.post("/green/text/scan", build_payload(tasks))

        response
      end

      def bulk_scan
        # TODO
      end

      def feedback
        # TODO
      end

      private

      def build_payload(tasks)
        payload = {
          bizType: "default",
          scenes: ["antispam"],
          tasks: tasks,
        }
        payload
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aliyun_green-0.1.4 lib/aliyun_green/text.rb
aliyun_green-0.1.3 lib/aliyun_green/text.rb