google_play_search 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google_play_search/app.rb +23 -2
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44f66c39d473b2c528f53bff29132967fc5ceea9
4
- data.tar.gz: 0cc55afbf75bcab630f5d5443af0c736c5df8453
3
+ metadata.gz: 59bf8d99c765e15e28e98ebb1498f4e63807b805
4
+ data.tar.gz: 19533f0a7c2aad86832b39d7b2de59bacd265cd6
5
5
  SHA512:
6
- metadata.gz: dbe0afb37208567b2fd40ffd1436fea82e0c420a26bebdcdfe9d58d45f6642954de437e2d1824cd0defc65619ece82d99030d1559f9a5a6778ee384ea5871759
7
- data.tar.gz: 8ae3249ea1c1f4271455242a6b48da5c433e936100ca162a829c40de0dc38dfee0da97f1c5d2c6209531148e66d575d3e65c205a85255569b49a61abf8b39e98
6
+ metadata.gz: 935beec80300b4d40a4b125e93afa97a6a99ebb2dac7a2fc18aef51c07a12c132ebf82b54e798dcc2ca1b9b84f501458891a0a6709b15558d3e6463d6866263e
7
+ data.tar.gz: 4c9db747dfbafb9e80651a726a6e47f8399d265c0caf58201a3094567be934b573fb08a13568f39b68c39be86d7344ebd7043790f92d37c180d38787e5a818d6
@@ -4,7 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/review')
4
4
  module GooglePlaySearch
5
5
  class App
6
6
  attr_accessor :id, :name, :url, :developer, :category, :logo_url,
7
- :short_description, :rating, :reviews, :price,
7
+ :short_description, :rating, :ratings_count, :reviews, :price,
8
+ :count_5_star, :count_4_star, :count_3_star, :count_2_star, :count_1_star,
8
9
  :version, :installs, :last_updated, :size,
9
10
  :requires_android, :content_rating, :developer_website,
10
11
  :developer_email, :developer_address, :screenshots,
@@ -24,9 +25,17 @@ module GooglePlaySearch
24
25
  self.developer_website = get_developer_website(google_play_html)
25
26
  self.developer_email = get_developer_email(google_play_html)
26
27
  self.developer_address = get_developer_address(google_play_html)
28
+ self.long_description = get_long_description(google_play_html)
29
+
30
+ self.ratings_count = get_ratings_count(google_play_html)
31
+ self.count_5_star = get_star_count(5, google_play_html)
32
+ self.count_4_star = get_star_count(4, google_play_html)
33
+ self.count_3_star = get_star_count(3, google_play_html)
34
+ self.count_2_star = get_star_count(2, google_play_html)
35
+ self.count_1_star = get_star_count(1, google_play_html)
36
+
27
37
  self.reviews = get_reviews(google_play_html)
28
38
  self.screenshots = get_screenshots(google_play_html)
29
- self.long_description = get_long_description(google_play_html)
30
39
  self
31
40
  rescue
32
41
  self
@@ -112,5 +121,17 @@ module GooglePlaySearch
112
121
  screenshots
113
122
  end
114
123
 
124
+ def get_ratings_count(google_play_html)
125
+ ratings_count = google_play_html.search("span[class='reviews-num']").first
126
+ ratings_count.content.strip if ratings_count
127
+ end
128
+
129
+ def get_star_count(num_stars, google_play_html)
130
+ star_word = ['zero', 'one', 'two', 'three', 'four', 'five'][num_stars]
131
+
132
+ stars_root = google_play_html.search("div[class='rating-bar-container #{star_word}']").first
133
+ stars_count = stars_root.search("span[class='bar-number']").first if stars_root
134
+ stars_count.content.strip if stars_count
135
+ end
115
136
  end
116
137
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_play_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-15 00:00:00.000000000 Z
11
+ date: 2016-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.4.5
86
+ rubygems_version: 2.5.1
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: google play market search