google_play_search 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module GooglePlaySearch
2
2
  class App
3
- attr_accessor :id, :name, :url, :developer, :category, :logo_url, :short_description, :point, :reviews
3
+ attr_accessor :id, :name, :url, :developer, :category, :logo_url, :short_description, :rating, :reviews
4
4
  end
5
5
  end
@@ -18,8 +18,8 @@ module GooglePlaySearch
18
18
  app.category = get_category app_content
19
19
  app.logo_url = get_logo_url app_content
20
20
  app.short_description = get_short_description app_content
21
- app.point = get_app_point app_content
22
- app.reviews = get_app_reviews app_content
21
+ app.rating = get_app_rating app_content
22
+ app.reviews = get_app_reviews app_content
23
23
  app_search_result_list << app
24
24
  end
25
25
  app_search_result_list
@@ -54,16 +54,22 @@ module GooglePlaySearch
54
54
  app_content.css("div.description").first.content
55
55
  end
56
56
 
57
- def get_app_point(app_content)
58
- point_str = app_content.css("div.ratings").first['title']
59
- unless point_str.empty?
60
- return point_str[/\d+\.?\d?/].to_f
61
- end
62
- return 0
63
- end
57
+ def get_app_rating(app_content)
58
+ ratings = app_content.css("div.ratings")
59
+ if ratings && ratings.size > 0
60
+ rating_str = ratings.first['title']
61
+ unless rating_str.empty?
62
+ return rating_str[/\d+\.?\d?/].to_f
63
+ end
64
+ return 0
65
+ end
66
+ end
64
67
 
65
- def get_app_reviews(app_content)
66
- app_content.css("span.snippet-reviews").first.content[1..-2].gsub(',','').to_i
67
- end
68
+ def get_app_reviews(app_content)
69
+ reviews = app_content.css("span.snippet-reviews")
70
+ if reviews && reviews.size > 0
71
+ reviews.first.content[1..-2].gsub(',','').to_i
72
+ end
73
+ end
68
74
  end
69
75
  end
@@ -49,6 +49,7 @@ module GooglePlaySearch
49
49
  start = (@current_page - 1) * @search_condition[:per_page_num]
50
50
  query_url << "start=#{start}&num=#{@search_condition[:per_page_num]}"
51
51
  end
52
-
53
52
  end
54
53
  end
54
+
55
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_play_search
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Grant Chen
@@ -42,9 +42,9 @@ extensions: []
42
42
  extra_rdoc_files: []
43
43
 
44
44
  files:
45
+ - lib/google_play_search/app_parser.rb
45
46
  - lib/google_play_search/search.rb
46
47
  - lib/google_play_search/app.rb
47
- - lib/google_play_search/app_parser.rb
48
48
  - lib/google_play_search.rb
49
49
  homepage: https://github.com/kucss/google_play_search
50
50
  licenses: []
@@ -75,9 +75,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  requirements: []
76
76
 
77
77
  rubyforge_project:
78
- rubygems_version: 1.8.19
78
+ rubygems_version: 1.8.24
79
79
  signing_key:
80
80
  specification_version: 3
81
81
  summary: google play market search
82
82
  test_files: []
83
83
 
84
+ has_rdoc: