class Object
Public Instance Methods
LP_email_screenshot(url, com_codes)
click to toggle source
# File lib/auto-print.rb, line 138 def LP_email_screenshot(url, com_codes) # if url =~ /(http)+[\S]*/ puts "printing versioned landing pages for the followign communities".blink driver = Selenium::WebDriver.for :firefox com_codes.each do |com| # printing email CS driver.navigate.to "#{url}"+"?from="+"#{com}-email".upcase driver.save_screenshot("#{com}".upcase+"-email.png") print "#{com}-EMAIL ".upcase end # end end
LP_screenshot(url, com_codes)
click to toggle source
# File lib/auto-print.rb, line 150 def LP_screenshot(url, com_codes) # if url =~ /(http)+[\S]*/ puts "printing versioned emails for the following communities".blink driver = Selenium::WebDriver.for :firefox com_codes.each do |com| # landing pages driver.navigate.to "#{url}"+"?from="+"#{com}".upcase driver.save_screenshot("#{com}".upcase+".png") print "#{com} ".upcase end # end end
email_question(url, com_codes, com = '')
click to toggle source
# File lib/auto-print.rb, line 104 def email_question(url, com_codes, com = '') puts "are these emails?[Y/N/X]".yellow emailResponse = STDIN.gets.strip.upcase print"\n\n" if emailResponse == 'Y' puts "is this a landing page connected to the email?".yellow emailLPresponse = STDIN.gets.strip.upcase print "\n\n" end unless com.length < 3 com_codes = ["#{com}"] end if emailResponse == 'Y' if emailLPresponse == 'Y' LP_email_screenshot(url, com_codes) else email_screenshot(url, com_codes) end elsif emailResponse == 'N' LP_screenshot(url, com_codes) else print "exiting sequence".red end end
email_screenshot(url, com_codes)
click to toggle source
# File lib/auto-print.rb, line 163 def email_screenshot(url, com_codes) # if url =~ /(http)+[\S]*/ puts "printing versioned emails for the following communities".blink driver = Selenium::WebDriver.for :firefox com_codes.each do |com| # landing pages driver.navigate.to "#{url}"+"#{com}".upcase+"_email.html" driver.save_screenshot("#{com}".upcase+".png") print "#{com} ".upcase end # end end
screenshot(name, url=ARGV[0])
click to toggle source
# File lib/auto-print.rb, line 132 def screenshot(name, url=ARGV[0]) driver = Selenium::WebDriver.for :firefox driver.navigate.to url driver.save_screenshot("#{name}"+".png") end
url_question(url, com_codes)
click to toggle source
line 68 catches any user input that relates to .xls files in the form of prune-erickson yourfile.xls [digit] outputfile.xls
# File lib/auto-print.rb, line 67 def url_question(url, com_codes) puts "\n\n" puts "Do you wish to screenshot of".yellow puts " #{url} ".red print "without additional versioning? [Y/N/X]\n\n".yellow puts "you can exit this form at any time by pressing the X key on your keyboard".upcase.yellow versioningResponse = STDIN.gets.strip.upcase print "\n\n" if versioningResponse == 'Y' puts "what do you wish to name the file?".green name = STDIN.gets.strip.upcase screenshot(name, url) elsif versioningResponse =='X' puts "exiting sequence" else version_question(url, com_codes) end end
version_question(url, com_codes)
click to toggle source
# File lib/auto-print.rb, line 87 def version_question(url, com_codes) puts "\n\n" puts "Is this campaign versioned? [Y/N/X]".yellow # puts "you can exit this form at any time by pressing the X key on your keyboard".yellow campaignResponse = STDIN.gets.strip.upcase print "\n\n" if campaignResponse =='Y' email_question( url, com_codes) else puts "which community do you wish to print please insert a 3 letter com code".yellow com = STDIN.gets.strip.upcase email_question(url, com_codes, com) end end