Sha256: 33f7da1c0c325d02a89e899d577819b8c4049bf44afb8b6ce6deb7d4967aab13

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

require 'hull/core_ext/hash'
require 'hull/client'
require 'hull/config'

module Hull
  extend Config
  class << self
    # Alias for Hull::Client.new
    #
    # @return [Hull::Client]
    def new(options={})
      Hull::Client.new(options)
    end

    def as(user_id)
      Hull::Client.new({ user_id: user_id })
    end

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

    def respond_to?(method, include_private=false)
      new.respond_to?(method, include_private) || super(method, include_private)
    end

    def log msg, level=:debug
      Hull.logger.send(level.to_sym, "[hull:#{Hull.domain}] #{msg}") if Hull.logger && Hull.logger.respond_to?(level.to_sym)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hullio-0.3.3 lib/hull.rb