Sha256: b9bb9af27d95e73e1ee0375270bb9dda9585bafd0a154c949418de62eb9db72b

Contents?: true

Size: 588 Bytes

Versions: 14

Compression:

Stored size: 588 Bytes

Contents

module MatrixQQ
  class QQ
    class DBus
      attr_reader :obj

      def initialize(dbus)
        srv = dbus.service('org.dastudio.qq')
        @obj = srv.object '/org/dastudio/qq'
        @obj.default_iface = 'org.dastudio.cqhttp'
      end

      def respond_to_missing?(name, include_private = false)
        @obj.respond_to_missing? name, include_private
      end

      def method_missing(name, *args)
        super if args.size > 1
        args << {} if args.empty?
        arg = args.first
        JSON.parse @obj.call(name.to_s, arg.to_json).first
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
matrix_qq-0.5.5 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.5.4 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.5.3 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.5.2 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.5.1 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.5.0 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.4.0 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.3.3 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.3.2 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.3.1 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.3.0 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.2.1 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.2.0 lib/matrix_qq/qq/dbus.rb
matrix_qq-0.1.1 lib/matrix_qq/qq/dbus.rb