Class: ChromeStoreSearch::App
- Inherits:
-
Object
- Object
- ChromeStoreSearch::App
- Defined in:
- lib/chrome_store_search/app.rb
Constant Summary collapse
- APP_DETAIL_BASE_URL =
"https://chrome.google.com/webstore/ajax/detail?"
- DEFAULT_PARAMETER =
{:hl =>"en-US"}
Instance Attribute Summary collapse
-
#big_logo_url ⇒ Object
Returns the value of attribute big_logo_url.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#images ⇒ Object
Returns the value of attribute images.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#short_description ⇒ Object
Returns the value of attribute short_description.
-
#site ⇒ Object
Returns the value of attribute site.
-
#small_logo_url ⇒ Object
Returns the value of attribute small_logo_url.
-
#support_url ⇒ Object
Returns the value of attribute support_url.
-
#total_rating_count ⇒ Object
Returns the value of attribute total_rating_count.
-
#total_users ⇒ Object
Returns the value of attribute total_users.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
-
#videos ⇒ Object
Returns the value of attribute videos.
Instance Method Summary collapse
-
#initialize(id = nil) ⇒ App
constructor
A new instance of App.
- #set_basic_info(app_item) ⇒ Object
- #update_detail_info(id, parmeter = DEFAULT_PARAMETER) ⇒ Object
Constructor Details
#initialize(id = nil) ⇒ App
Returns a new instance of App.
16 17 18 |
# File 'lib/chrome_store_search/app.rb', line 16 def initialize(id=nil) update_detail_info(id) if id end |
Instance Attribute Details
#big_logo_url ⇒ Object
Returns the value of attribute big_logo_url.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def big_logo_url @big_logo_url end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def id @id end |
#images ⇒ Object
Returns the value of attribute images.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def images @images end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def name @name end |
#rating ⇒ Object
Returns the value of attribute rating.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def @rating end |
#short_description ⇒ Object
Returns the value of attribute short_description.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def short_description @short_description end |
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def site @site end |
#small_logo_url ⇒ Object
Returns the value of attribute small_logo_url.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def small_logo_url @small_logo_url end |
#support_url ⇒ Object
Returns the value of attribute support_url.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def support_url @support_url end |
#total_rating_count ⇒ Object
Returns the value of attribute total_rating_count.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def @total_rating_count end |
#total_users ⇒ Object
Returns the value of attribute total_users.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def total_users @total_users end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def updated_at @updated_at end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def version @version end |
#videos ⇒ Object
Returns the value of attribute videos.
7 8 9 |
# File 'lib/chrome_store_search/app.rb', line 7 def videos @videos end |
Instance Method Details
#set_basic_info(app_item) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/chrome_store_search/app.rb', line 30 def set_basic_info(app_item) self.id = app_item[0] self.name = app_item[1] self.small_logo_url = app_item[3].encode("UTF-8") self.short_description = app_item[6] self. = app_item[12] self. = app_item[22].to_i self.total_users = app_item[23].gsub(",", "").to_i self.big_logo_url = app_item[25].encode("UTF-8") self.url = app_item[37] end |
#update_detail_info(id, parmeter = DEFAULT_PARAMETER) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/chrome_store_search/app.rb', line 20 def update_detail_info(id, parmeter = DEFAULT_PARAMETER) @parmeter = DEFAULT_PARAMETER.merge(parmeter) conn = Faraday.new(:url => init_detail_url(id)) do |faraday| faraday.request :url_encoded faraday.adapter Faraday.default_adapter end res = conn.post '', {} parse_detail(res.body) end |