Sha256: 71d8c0d15e727cb7d1731f11a7802e44f9aae30f44d2bd47a788f782d825195e

Contents?: true

Size: 814 Bytes

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
hullio-0.3.2 lib/hull.rb
hullio-0.3.1 lib/hull.rb
hullio-0.3.0 lib/hull.rb