Sha256: a2ab267580c6fec6028308983677cf52d055cfd7b5066fb52bb599cc8b1e249f

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module DocomoNlu
  module Management::V26
    class Log < Base
      self.element_name = "logs"
      self.prefix = "/management/v2.6/projects/:project_id/"

      # Format of params:
      # => {
      # =>  "details":[
      # =>   {"operation":"","target":"input","query":"Hello"},
      # =>   {"operation":"AND","target":"","query":"xx"},
      # =>  ]
      # => }
      # operation: NOT or Empty in leading line, others are AND|OR|NOT.
      # target: input|output|startTopic|endTopic|userId|language|projectSpecific|responseTime_less_than|responseTime_greater_than
      # => It is possible to ambiguous search using "*" in the following target ( input|output|startTopic|endTopic|userId|language|projectSpecific)
      # query: String search within 200 characters.

      def download(params = {})
        JSON.parse(connection.post(collection_path(prefix_options), params.to_json, self.class.headers).body)
      end

      def count(params = {})
        JSON.parse(connection.post("#{collection_path(prefix_options)}/count", params.to_json, self.class.headers).body)["count"]
      end

      def all
        Rails.logger.debug "You shoud use 'download' or 'count' method"
      end

      def find
        Rails.logger.debug "You shoud use 'download' or 'count' method"
      end

      def where
        Rails.logger.debug "You shoud use 'download' or 'count' method"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docomo-nlu-0.2.7 lib/docomo-nlu/management/V26/log.rb
docomo-nlu-0.2.6 lib/docomo-nlu/management/V26/log.rb