Sha256: de58e2e3786a6ba22b684b3fbf6c732f8e6c90864cef0c1d94d4a71b8096d51e

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require "dingbot/version"
require 'dingbot/error'
require 'dingbot/client'
require 'dingbot/message/text'
require 'dingbot/message/link'
require 'dingbot/message/markdown'
require 'dingbot/message/action_card'
require 'dingbot/message/feed_card'

module DingBot

  ENDPOINT = "https://oapi.dingtalk.com/robot/send"

  # Alias for DingBot::Client.new
  #
  # @return [DingBot::Client]
  def self.client(access_token='')
    DingBot::Client.new(access_token)
  end

  # Delegate to DingBot::Client
  def self.method_missing(method, *args, &block)
    return super unless client.respond_to?(method)
    client.send(method, *args, &block)
  end

  # Delegate to DingBot::Client
  def respond_to_missing?(method_name, include_private = false)
    client.respond_to?(method_name) || super
  end

  # Delegate to HTTParty.http_proxy
  def self.http_proxy(address=nil, port=nil, username=nil, password=nil)
    DingBot::Client.http_proxy(address, port, username, password)
  end

  # Returns an unsorted array of available client methods.
  #
  # @return [Array<Symbol>]
  def self.actions
    hidden = /access_token|post|validate|set_request_defaults|httparty/
    (DingBot::Client.instance_methods - Object.methods).reject {|e| e[hidden]}
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dingbot-0.1.1 lib/dingbot.rb
dingbot-0.1.0 lib/dingbot.rb