Class: Taaze::TaazeBooktags

Inherits:
Object
  • Object
show all
Defined in:
lib/taaze/tags.rb

Overview

This class get the product id as an input return a list of tags Sample input with product id : 11100763252 Sample output [‘轉型正義’, ‘白色恐怖’, ‘社會科學’, ‘臺灣民主運動’]

Constant Summary collapse

BOOKS_URL =
'http://www.taaze.tw/sing.html?pid='

Instance Method Summary collapse

Constructor Details

#initialize(book_id) ⇒ TaazeBooktags

Returns a new instance of TaazeBooktags.



13
14
15
# File 'lib/taaze/tags.rb', line 13

def initialize(book_id)
  parse_html(book_id)
end

Instance Method Details

#tagsObject

Return a list of book’s tags



18
19
20
# File 'lib/taaze/tags.rb', line 18

def tags
  @tags ||= extract_tags
end