Class: ChannelsPage

Inherits:
ItemsPage show all
Defined in:
lib/etvnet_seek/core/channels_page.rb

Constant Summary collapse

CHANNELS_URL =
Page::BASE_URL + "/tv_channels/"

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 ItemsPage

#categories, #category_breadcrumbs, #description, #navigation_menu, #page_browser, #page_title, #see_too_items, #title, #title_items

Methods inherited from ServiceCall

#get, #post

Constructor Details

#initialize(url = CHANNELS_URL) ⇒ ChannelsPage

Returns a new instance of ChannelsPage.



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

def initialize url = CHANNELS_URL
  super(url)
end

Instance Method Details

#itemsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/etvnet_seek/core/channels_page.rb', line 12

def items
  list = []

  document.css("#table-onecolumn-kanali tr").each do |item|
    links = item.css("td a")

    text = item.children.at(0).text.strip

    href = links[0]
    catalog_href = links[1]

    link = href.attributes['href'].value

    catalog_link = catalog_href.attributes['href'].value

    list << ChannelMediaItem.new(text, link, catalog_link)
  end

  list
end