lib/hull.rb in hullio-0.3.3 vs lib/hull.rb in hullio-0.4.0

- old
+ new

@@ -1,8 +1,9 @@ require 'hull/core_ext/hash' require 'hull/client' require 'hull/config' +require 'hull/entity' module Hull extend Config class << self # Alias for Hull::Client.new @@ -10,11 +11,15 @@ # @return [Hull::Client] def new(options={}) Hull::Client.new(options) end - def as(user_id) - Hull::Client.new({ user_id: user_id }) + def as(user) + if user.is_a?(String) + Hull::Client.new({ user_id: user }) + else + Hull::Client.new({ access_token: self.user_token(user) }) + end end # Delegate to Hull::Client def method_missing(method, *args, &block) return super unless new.respond_to?(method)