Class: Taaze::TaazeComments

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

Overview

This class get the user personal page as an input return a hash of user’s collections information For example, with user’s url: www.taaze.tw/container_zekeaclt_view.html?ci=12522728 here’s the user’s comments of books: www.taaze.tw/container_zekeaclt_view.html?ci=12522728&cp=2 Sampel output (plz remove them after passing the test):

Constant Summary collapse

USERS_URL =
'http://www.taaze.tw/container_zekeaclt_view.html?ci='
MAIN_URL =
'http://www.taaze.tw/container_zekeaclt_view.html?'
API_URL =
'http://www.taaze.tw/beta/zekeaCommentDataAgent.jsp?custId='
BOOK_URL =
'http://www.taaze.tw/sing.html?pid='

Instance Method Summary collapse

Constructor Details

#initialize(user_id) ⇒ TaazeComments

Returns a new instance of TaazeComments.



20
21
22
23
# File 'lib/taaze/comments.rb', line 20

def initialize(user_id)
  user_id = numeric?(user_id) ? user_id.to_s : user_id
  parse_html(user_id)
end

Instance Method Details

#commentsObject

Return a hash of user’s comments



26
27
28
# File 'lib/taaze/comments.rb', line 26

def comments
  @comments_found
end