Class: CityWatch::Page
- Inherits:
-
Object
- Object
- CityWatch::Page
- Defined in:
- lib/city_watch/page.rb
Instance Method Summary collapse
-
#build_id ⇒ Object
Todo: this is gross.
-
#initialize ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize ⇒ Page
Returns a new instance of Page.
4 5 6 7 |
# File 'lib/city_watch/page.rb', line 4 def initialize html = RestClient.get("#{CityWatch.url}/project.html?projectId=#{CityWatch.project_id}") @doc = Nokogiri::HTML(html) end |
Instance Method Details
#build_id ⇒ Object
Todo: this is gross.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/city_watch/page.rb', line 10 def build_id @doc.xpath("//a[contains(.,'#{CityWatch.build_title}')]"). first. parent. parent. next_sibling. next_sibling. children. first. children[2]. children[1]. attributes['id']. value. split(':')[1]. split(':')[0]. to_i end |