class Humidifier::Upgrade
Constants
- PATH
- URL
Public Class Methods
perform()
click to toggle source
# File lib/humidifier/upgrade.rb, line 20 def self.perform new.perform end
Public Instance Methods
perform()
click to toggle source
# File lib/humidifier/upgrade.rb, line 9 def perform require "net/http" require "nokogiri" response = Net::HTTP.get_response(uri).body parsed = JSON.parse(response) File.write(PATH, JSON.pretty_generate(parsed)) parsed["ResourceSpecificationVersion"] end
Private Instance Methods
page()
click to toggle source
# File lib/humidifier/upgrade.rb, line 26 def page Net::HTTP.get_response(URI.parse(URL)).body end
uri()
click to toggle source
# File lib/humidifier/upgrade.rb, line 30 def uri Nokogiri::HTML(page).css("table tr").detect do |tr| name = tr.at_css("td:first-child p") next if !name || name.text.strip != "US East (N. Virginia)" break URI.parse(tr.at_css("td:nth-child(3) p a").attr("href")) end end