Sha256: 5bf80d48e97ed59f92463d9df9c9f5cf21cdfc8c9623a3be6e67e09246506a35
Contents?: true
Size: 629 Bytes
Versions: 1
Compression:
Stored size: 629 Bytes
Contents
require "open-uri" require "json" require "dotenv" module EmailCrawler class Proxy class << self def random all.sample end private def all @all ||= begin Dotenv.load json = JSON.parse(open("https://api.digitalocean.com/droplets/?client_id=#{ENV['DO_CLIENT_ID']}&api_key=#{ENV['DO_API_KEY']}", ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE).read) json["droplets"]. select{ |droplet| droplet["name"] =~ /proxy\d+/ }. map { |droplet| droplet["ip_address"] } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
email_crawler-0.0.3 | lib/email_crawler/proxy.rb |