Sha256: bc1c4420ecf3b0ad3f3ddd0b609495357784dad8785213732babe3705475df65
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module Dingtalk module Client # @example Config single item # Dingtalk::Client.group_robot_tokens = { default: 'TOKENXXXXXXXXXXX' } # @example Config multiple items # Dingtalk::Client.configure do |config| # config.group_robot_tokens = { default: 'TOKENXXXXXXXBBXX' } # config.group_robot_webhook_prefix = 'http://dingtalk.com?access_token=' # end module Configurable def self.included(base) base.extend ClassMethods end # @see Configurable module ClassMethods def configure yield config end def config @config ||= Configuration.new end end # @see Configurable class Configuration attr_writer :group_robot_tokens, :group_robot_webhook_prefix, :template_dir def initialize @group_robot_webhook_prefix = 'https://oapi.dingtalk.com/robot/send?access_token=' @template_dir = '.' end def group_robot_tokens return @group_robot_tokens.symbolize_keys if @group_robot_tokens.is_a?(Hash) raise ConfigurationError.new(:group_robot_tokens, @group_robot_tokens, Hash) end def group_robot_webhook_prefix String(@group_robot_webhook_prefix) end def template_dir String(@template_dir) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dingtalk-client-0.2.0 | lib/dingtalk/client/configurable.rb |