lib/fanforce/main.rb in fanforce-0.3.7 vs lib/fanforce/main.rb in fanforce-0.3.8
- old
+ new
@@ -4,12 +4,16 @@
class Fanforce
include Fanforce::Utils
attr_reader :params
########################################################################
- def initialize(params={})
- add_params(params)
- auth(@params) if @params.length > 0
+ def initialize(arg={})
+ if arg.is_a?(Hash)
+ add_params(arg)
+ auth(@params) if @params.length > 0
+ elsif arg.is_a?(String)
+ auth(arg)
+ end
end
def add_params(params)
@params ||= {}
@params.merge!(collect_known_params params)