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.
166 167 168 169 170 171 172 173 174 175 |
# File 'lib/google-play-class.rb', line 166 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.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def artist @artist end |
#explicit ⇒ Object
Returns the value of attribute explicit.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def explicit @explicit end |
#id ⇒ Object
Returns the value of attribute id.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def id @id end |
#price ⇒ Object
Returns the value of attribute price.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def price @price end |
#thumbnail ⇒ Object
Returns the value of attribute thumbnail.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def thumbnail @thumbnail end |
#title ⇒ Object
Returns the value of attribute title.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
164 165 166 |
# File 'lib/google-play-class.rb', line 164 def type @type end |
Instance Method Details
#fillSearchData(type, list) ⇒ Object
177 178 179 180 181 182 183 184 |
# File 'lib/google-play-class.rb', line 177 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
202 203 204 205 206 |
# File 'lib/google-play-class.rb', line 202 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
208 209 210 211 212 |
# File 'lib/google-play-class.rb', line 208 def get_explicit(doc) if doc.css('.explicit').length != 0 @explicit = 1 end end |
#get_id(doc) ⇒ Object
186 187 188 |
# File 'lib/google-play-class.rb', line 186 def get_id(doc) @id = doc['data-docid'] end |
#get_price(doc) ⇒ Object
196 197 198 199 200 |
# File 'lib/google-play-class.rb', line 196 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
214 215 216 217 218 |
# File 'lib/google-play-class.rb', line 214 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
190 191 192 193 194 |
# File 'lib/google-play-class.rb', line 190 def get_title(doc) if doc.css('a.title').length != 0 @title = doc.css('a.title')[0]['title'] end end |