lib/adwords4r/credentials.rb in adwords4r-0.5 vs lib/adwords4r/credentials.rb in adwords4r-0.6

- old
+ new

@@ -14,28 +14,30 @@ @value end end class AdWordsCredentials - attr_reader :handlers + attr_reader :handlers, :alternateUrl def getDefaults() cred = Hash.new IO.foreach("#{ENV['HOME']}/adwords.properties") {|line| addCredential(cred, line.split('=')) if !(line =~ /^#/)} return cred end def addCredential(cred, arr) - cred[arr[0]] = arr[1] + cred[arr[0]] = arr[1].strip end def initialize(*parm) @handlers = [] + @alternateUrl = nil if parm[0] credentials = parm[0] else credentials = getDefaults() end - credentials.each {|key, value| @handlers << HeaderHandler.new(key, value)} + credentials.each {|key, value| @handlers << HeaderHandler.new(key, value) if !(key =~ /^alternateUrl/)} + @alternateUrl = credentials['alternateUrl'] end end end