Sha256: 418baa9380f0793120d3a231f68a5f1f8e43ce7ebd7b15d645561965c8de1a4a
Contents?: true
Size: 660 Bytes
Versions: 4
Compression:
Stored size: 660 Bytes
Contents
# frozen_string_literal: true module Typesense class AnalyticsRules RESOURCE_PATH = '/analytics/rules' def initialize(api_call) @api_call = api_call @analytics_rules = {} end def upsert(rule_name, params) @api_call.put(endpoint_path(rule_name), params) end def retrieve @api_call.get(endpoint_path) end def [](rule_name) @analytics_rules[rule_name] ||= AnalyticsRule.new(rule_name, @api_call) end private def endpoint_path(operation = nil) "#{AnalyticsRules::RESOURCE_PATH}#{operation.nil? ? '' : "/#{URI.encode_www_form_component(operation)}"}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems