class Renuo::Cli::Commands::FetchEmails
Constants
- EMAIL_LIST_URL
Public Instance Methods
Source
# File lib/renuo/cli/commands/fetch_emails.rb, line 18 def fetch_emails response = get_emails(EMAIL_LIST_URL) response = handle_redirection(response) if response.is_a?(Net::HTTPRedirection) format_response(response) end
Source
# File lib/renuo/cli/commands/fetch_emails.rb, line 13 def run say "# Here is a complete list of Renuo email addresses".colorize :green say fetch_emails.join("\n") end
Private Instance Methods
Source
# File lib/renuo/cli/commands/fetch_emails.rb, line 36 def format_response(response) response.body.gsub("\r\n", "\n").split("\n").reject { |add| add == "n/a" } end
Source
# File lib/renuo/cli/commands/fetch_emails.rb, line 26 def get_emails(url) uri = URI.parse(url) Net::HTTP.get_response(uri) end
Source
# File lib/renuo/cli/commands/fetch_emails.rb, line 31 def handle_redirection(response) location = response["location"] get_emails(location) end