Module: Wta

Defined in:
lib/wta.rb,
lib/wta/version.rb

Constant Summary collapse

RED =
3
YELLA =
2
INFO =
1
FINE =
0
NA =
"NA"
SA =
"SA"
EU =
"EU"
AP =
"AP"
VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.bo_selecta(statusnum, region) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/wta.rb', line 35

def self.bo_selecta(statusnum, region)
  pull_statuses(region)
  @all_status_images.select { |img|
    img.attributes['src'].value == "/images/status#{statusnum}.gif"
  }.map { |img|
    img.parent.parent.children[3].children[0]
  }
end

.infos(region = NA) ⇒ Object



27
28
29
# File 'lib/wta.rb', line 27

def self.infos(region=NA)
  bo_selecta(INFO, region)
end

.operating(region = NA) ⇒ Object



31
32
33
# File 'lib/wta.rb', line 31

def self.operating(region=NA)
  bo_selecta(FINE, region)
end

.pull_statuses(region) ⇒ Object



44
45
46
47
# File 'lib/wta.rb', line 44

def self.pull_statuses(region)
  @html = Nokogiri::HTML(open(URI.parse('http://status.aws.amazon.com/')))
  @all_status_images = @html.css('#current_events_block #' + region.upcase + '_block td img')
end

.reds(region = NA) ⇒ Object



19
20
21
# File 'lib/wta.rb', line 19

def self.reds(region=NA)
  bo_selecta(RED, region)
end

.regionsObject



15
16
17
# File 'lib/wta.rb', line 15

def self.regions
  [NA, SA, EU, AP]
end

.yellows(region = NA) ⇒ Object



23
24
25
# File 'lib/wta.rb', line 23

def self.yellows(region=NA)
  bo_selecta(YELLA, region)
end