chrome_store_search 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,6 @@ require File.expand_path(File.dirname(__FILE__) + '/string_utility')
|
|
4
4
|
|
5
5
|
module ChromeStoreSearch
|
6
6
|
class App
|
7
|
-
include StringUtility
|
8
7
|
attr_accessor :id, :name, :url, :short_description, :small_logo_url,
|
9
8
|
:big_logo_url, :rating, :total_rating_count,
|
10
9
|
:total_users, :description, :site, :version,
|
@@ -51,7 +50,7 @@ module ChromeStoreSearch
|
|
51
50
|
end
|
52
51
|
|
53
52
|
def parse_detail(app_detail_body)
|
54
|
-
detail_info = JSON.parse(gsub_continuation_commas(app_detail_body[4..-1]))[1][1]
|
53
|
+
detail_info = JSON.parse(StringUtility.gsub_continuation_commas(app_detail_body[4..-1]))[1][1]
|
55
54
|
basic_info = detail_info[0]
|
56
55
|
set_basic_info(basic_info)
|
57
56
|
self.description = detail_info[1]
|
@@ -4,10 +4,9 @@ require File.expand_path(File.dirname(__FILE__) + '/string_utility')
|
|
4
4
|
|
5
5
|
module ChromeStoreSearch
|
6
6
|
class AppParser
|
7
|
-
include StringUtility
|
8
7
|
|
9
8
|
def self.parse(apps_json_body)
|
10
|
-
apps_json_array = JSON.parse(gsub_continuation_commas(apps_json_body[4..-1]))[1][1]
|
9
|
+
apps_json_array = JSON.parse(StringUtility.gsub_continuation_commas(apps_json_body[4..-1]))[1][1]
|
11
10
|
apps = []
|
12
11
|
apps_json_array.each do |app_item|
|
13
12
|
apps << new_app_instance(app_item)
|
@@ -1,15 +1,13 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module ChromeStoreSearch
|
2
|
+
class StringUtility
|
3
|
+
def self.gsub_continuation_commas(json_str)
|
4
|
+
json_str.gsub(/,,,*/) do |commas_str|
|
5
|
+
replace_str = ""
|
6
|
+
(commas_str.size-1).times do |index|
|
7
|
+
replace_str += ",\"\""
|
8
|
+
end
|
9
|
+
commas_str = replace_str + ","
|
7
10
|
end
|
8
|
-
commas_str = replace_str + ","
|
9
11
|
end
|
10
12
|
end
|
11
|
-
|
12
|
-
def StringUtility.included cls
|
13
|
-
cls.extend StringUtility
|
14
|
-
end
|
15
13
|
end
|
data/lib/chrome_store_search.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'chrome_store_search/search'
|
2
|
+
module ChromeStoreSearch
|
3
|
+
end
|