Class: TopResult
- Inherits:
-
Object
- Object
- TopResult
- Defined in:
- lib/google-play-class.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#explicit ⇒ Object
Returns the value of attribute explicit.
-
#id ⇒ Object
Returns the value of attribute id.
-
#price ⇒ Object
Returns the value of attribute price.
-
#thumbnail ⇒ Object
Returns the value of attribute thumbnail.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #fillSearchData(type, list) ⇒ Object
- #get_artist(doc) ⇒ Object
- #get_explicit(doc) ⇒ Object
- #get_id(doc) ⇒ Object
- #get_price(doc) ⇒ Object
- #get_thumbnail(doc) ⇒ Object
- #get_title(doc) ⇒ Object
-
#initialize(type, list) ⇒ TopResult
constructor
A new instance of TopResult.
Constructor Details
#initialize(type, list) ⇒ TopResult
Returns a new instance of TopResult.
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/google-play-class.rb', line 167 def initialize(type,list) @id="" @type=type @title="" @price="" if type == "music" then @artist="" end @explicit="" @thumbnail="" fillSearchData(type,list) end |
Instance Attribute Details
#artist ⇒ Object
Returns the value of attribute artist.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def artist @artist end |
#explicit ⇒ Object
Returns the value of attribute explicit.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def explicit @explicit end |
#id ⇒ Object
Returns the value of attribute id.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def id @id end |
#price ⇒ Object
Returns the value of attribute price.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def price @price end |
#thumbnail ⇒ Object
Returns the value of attribute thumbnail.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def thumbnail @thumbnail end |
#title ⇒ Object
Returns the value of attribute title.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
165 166 167 |
# File 'lib/google-play-class.rb', line 165 def type @type end |
Instance Method Details
#fillSearchData(type, list) ⇒ Object
178 179 180 181 182 183 184 185 |
# File 'lib/google-play-class.rb', line 178 def fillSearchData(type,list) get_id(list) get_title(list) get_price(list) get_artist(list) get_explicit(list) get_thumbnail(list) end |
#get_artist(doc) ⇒ Object
203 204 205 206 207 |
# File 'lib/google-play-class.rb', line 203 def get_artist(doc) if doc.css('span.attribution div a').length != 0 @artist = doc.css('span.attribution div a').text end end |
#get_explicit(doc) ⇒ Object
209 210 211 212 213 |
# File 'lib/google-play-class.rb', line 209 def get_explicit(doc) if doc.css('.explicit').length != 0 @explicit = 1 end end |
#get_id(doc) ⇒ Object
187 188 189 |
# File 'lib/google-play-class.rb', line 187 def get_id(doc) @id = doc['data-docid'] end |
#get_price(doc) ⇒ Object
197 198 199 200 201 |
# File 'lib/google-play-class.rb', line 197 def get_price(doc) if doc.css('span.buy-button-price').length != 0 @price = doc.css('span.buy-button-price').text end end |
#get_thumbnail(doc) ⇒ Object
215 216 217 218 219 |
# File 'lib/google-play-class.rb', line 215 def get_thumbnail(doc) if doc.css('.thumbnail-wrapper .thumbnail img').length != 0 @thumbnail = doc.css('.thumbnail-wrapper .thumbnail img')[0]['src'] end end |
#get_title(doc) ⇒ Object
191 192 193 194 195 |
# File 'lib/google-play-class.rb', line 191 def get_title(doc) if doc.css('a.title').length != 0 @title = doc.css('a.title')[0]['title'] end end |