Module: StoreApi::GooglePlay::Card
- Included in:
- Apps::Developer, Apps::Search
- Defined in:
- lib/store_api/google_play/card.rb
Instance Method Summary collapse
-
#parse(doc) ⇒ Array
card parts parse.
Instance Method Details
#parse(doc) ⇒ Array
card parts parse
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/store_api/google_play/card.rb', line 11 def parse(doc) card_list = [] doc.css('.card-list > .card').each do |node| rank = node.css('.title').text.split('.')[0].strip if (/^[+-]?[0-9]+$/ =~ rank) rank = rank.to_i else rank = nil end card_list.push( {:id => node.css('.preview-overlay-container')[0]['data-docid'], :title => node.css('.title')[0]['title'].strip, :cover_image => node.css('.cover-image').attribute('src').value, :details_url => node.css('.title').attribute('href').value, :developer => node.css('.subtitle').attribute('title').value.strip, :price => node.css('.display-price')[0].text, :rank => rank} ) end card_list end |