Class: Taaze::TaazeCollections
- Inherits:
-
Object
- Object
- Taaze::TaazeCollections
- Defined in:
- lib/taaze/collections.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 collections of books: www.taaze.tw/container_zekeaclt_view.html?ci=12522728&cp=1 Sampel output (plz remove them after passing the test): [
{"title"=>"村上收音機", "book_url"=>"http://www.taaze.tw/sing.html?pid=11100635522"}
{"title"=>"尋找漩渦貓的方法", "book_url"=>"http://www.taaze.tw/sing.html?pid=11100210251"}
and so on ...
]
Constant Summary collapse
- USERS_URL =
'http://www.taaze.tw/container_zekeaclt_view.html?ci='- API_URL =
'http://www.taaze.tw/beta/zekeacltBooksDataAgent.jsp?custId='- BOOK_URL =
'http://www.taaze.tw/sing.html?pid='
Instance Method Summary collapse
-
#collections ⇒ Object
Return a hash of user’s collections.
-
#initialize(user_id) ⇒ TaazeCollections
constructor
A new instance of TaazeCollections.
Constructor Details
#initialize(user_id) ⇒ TaazeCollections
Returns a new instance of TaazeCollections.
21 22 23 |
# File 'lib/taaze/collections.rb', line 21 def initialize(user_id) parse_html(user_id) end |
Instance Method Details
#collections ⇒ Object
Return a hash of user’s collections
26 27 28 |
# File 'lib/taaze/collections.rb', line 26 def collections @collections ||= extract_books end |