lib/apidragon/api.rb in apidragon-1.4.6 vs lib/apidragon/api.rb in apidragon-1.5.0

- old
+ new

@@ -12,14 +12,16 @@ class Api < ArgBucket # Uses the configuration data in config.yaml to run a sequence of api calls. # All variables are dumped into a variable bucket (@arg_bucket) # so that they can be used as parameters for function calls. - def initialize(macro_name, config) + def initialize(macro_name, config, username, password) @config_file = config `mkdir #{PLUGINS}` unless Dir.exist? PLUGINS @arg_bucket = {} + set 'username', username unless username.nil? + set 'password', password unless password.nil? @config = load_config @config_file import @config['vars'] @macro = @config['macros'][macro_name] if @macro.nil? then fail "Command: '#{macro_name}' is not defined." end end @@ -33,10 +35,10 @@ @macro.each_pair do |_key, value| call = Call.new(value, @arg_bucket) @arg_bucket = call.run if !value['record'].nil? value['record'].each do |var| - add_config_var var, get(var) + add_config_var var, get(var) unless var=='function' end end end end