Class: FreetvPage

Inherits:
MediaPage show all
Defined in:
lib/etvnet_seek/core/freetv_page.rb

Constant Summary collapse

FREETV_URL =
BASE_URL + "/freeTV.html"

Constants inherited from Page

Page::BASE_URL

Instance Attribute Summary

Attributes inherited from Page

#document

Attributes inherited from ServiceCall

#url

Instance Method Summary collapse

Methods inherited from BasePage

#page_title, #title

Methods inherited from ServiceCall

#get, #post

Constructor Details

#initializeFreetvPage

Returns a new instance of FreetvPage.



4
5
6
# File 'lib/etvnet_seek/core/freetv_page.rb', line 4

def initialize
  super(FREETV_URL)
end

Instance Method Details

#category_breadcrumbsObject



8
9
10
# File 'lib/etvnet_seek/core/freetv_page.rb', line 8

def category_breadcrumbs
  []
end

#itemsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/etvnet_seek/core/freetv_page.rb', line 12

def items
  list = []

  document.css("table tr").each do |item|
    node = item.css("td img")
    if node.size > 0
      text = node.at(0).parent.css("a")
      unless text.to_s.size == 0
        link = node.at(0).parent.css("a")
        text = link.at(0).text.gsub(/\s\s+/, ' ')
        rating_image = node.at(0).attributes['src']
        image = link.at(0).parent.parent.previous.css("td img").at(0).attributes['src'].value.strip
        
        href = link.at(0).attributes['href'].value.strip

        record = BrowseMediaItem.new(text, href)
        record.rating_image = rating_image
        record.image = image

        list << record
      end
    end
  end

  list
end