google_play_reviews 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db483269bf262a26e1a83f9cdaee32d16d33667b
4
- data.tar.gz: 0c9b44e55cc34b4fbcbd82b88f6659a2f71fa6f1
3
+ metadata.gz: bfb7eaf2b850e64a45299cd7e192e6ec4c373e7d
4
+ data.tar.gz: f11799328a9206e8a3e38ef9ba873c09dcb7d12e
5
5
  SHA512:
6
- metadata.gz: 702613c6a54a0228f803652e3d352f1c1e19c7aa0773c350dc5df4445daa195ec568aec397f709e3d830700a3eb30f55c3c6cdfc21c4b0c15214bd092d6ed4e8
7
- data.tar.gz: 69fbd311bf2af46c6b5f1cc3f4caa257da4d2c47afb31501096e3c991e6e8c0c395848a0310d2ea694afbce20ea9a4d3d77038b18685f9f231e4807f2c688226
6
+ metadata.gz: f8b5867a2c59a6c4519ec79c0401a1e6b1cb42c6496285cb350b1efa36b9555ef951e59db08f6dc0fc65f548b1060ccf03d4477ab54a62e1484ae05d558bf399
7
+ data.tar.gz: 7b0f51282771b4e137ecffb0962a3dd990e8fbf93bfb24c2c8abdba3b4b4a1e606723f303f78a6c8cbefb3cb3369aba8075a481f0a49639abf832ff5d173b5b4
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -9,6 +9,10 @@ options = {}
9
9
  opts = OptionParser.new do |opts|
10
10
  opts.banner = "Usage: google_play_reviews [options] APP_ID"
11
11
 
12
+ opts.on("-l [VALUE]", "--host-language [VALUE]", "Host language: use 'en' as default") do |host_language|
13
+ options[:host_language] = host_language
14
+ end
15
+
12
16
  opts.on("-s [VALUE]", "--sort-order [VALUE]", "Sort order: 'newest'(default), 'rating' or 'helpfulness'") do |sort_order|
13
17
  puts "Invalid sort-order." unless GooglePlayReviews.invalid_sort_order?(sort_order.to_sym)
14
18
  options[:sort_order] = GooglePlayReviews::SortOrder[sort_order.to_sym]
@@ -19,17 +23,16 @@ opts = OptionParser.new do |opts|
19
23
  end
20
24
 
21
25
  opts.on("-v", "--version", "Display the current version") do
22
- puts "command_timer " + GooglePlayReviews::VERSION
26
+ puts "google_play_reviews " + GooglePlayReviews::VERSION
23
27
  exit 0
24
28
  end
25
-
26
29
  end
27
30
  opts.parse!
28
31
 
29
- (ARGV[0] = '-h'; opts.parse!) unless ARGV[0]
32
+ (ARGV[0] = '--help'; opts.parse!) unless ARGV[0]
30
33
 
31
34
  entries = GooglePlayReviews.fetch(ARGV[0], options)
32
- if entries.any?
35
+ if entries && entries.any?
33
36
  puts "------------------------------"
34
37
  entries.each do |entry|
35
38
  puts entry
@@ -12,6 +12,7 @@ module GooglePlayReviews
12
12
  class << self
13
13
  def fetch(app_id, options = {})
14
14
  return unless app_id
15
+ options[:host_language] ||= "en"
15
16
  options[:sort_order] ||= SortOrder[:newest]
16
17
  options[:page] ||= 0
17
18
  Fetcher.new.fetch_entries(app_id, options)
@@ -19,6 +19,7 @@ module GooglePlayReviews
19
19
  end
20
20
 
21
21
  private
22
+
22
23
  def fetch_html_from_google_play
23
24
  uri = URI.parse(GET_REVIEWS_URL)
24
25
  http = Net::HTTP.new(uri.host, uri.port)
@@ -29,7 +30,9 @@ module GooglePlayReviews
29
30
  id: app_id,
30
31
  reviewSortOrder: @options[:sort_order],
31
32
  reviewType: 1,
32
- pageNum: @options[:page]
33
+ pageNum: @options[:page],
34
+ xhr: 1,
35
+ hl: @options[:host_language],
33
36
  })
34
37
  response = http.start do |h|
35
38
  h.request(request)
@@ -50,7 +53,8 @@ module GooglePlayReviews
50
53
  entry.author_url = GOOGLE_PLAY_ROOT_URL + node.css(".author-name a").first["href"]
51
54
  entry.author_image_url = node.css(".author-image").first["src"]
52
55
  end
53
- entry.review_body = node.css(".review-body").first.text.strip.sub(/ 全文を表示$/, '')
56
+ node.css(".review-body").first.css("a").remove
57
+ entry.review_body = node.css(".review-body").first.text.strip
54
58
  entry.rating = node.css(".current-rating").first["style"].gsub(/[^0-9]/, '').to_i / 20
55
59
  entry.review_date_string = node.css(".review-date").first.text
56
60
  entry.review_url = GOOGLE_PLAY_ROOT_URL + node.css("a.reviews-permalink").first["href"]
@@ -1,3 +1,3 @@
1
1
  module GooglePlayReviews
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_play_reviews
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weihu Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-07 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -107,8 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.4.6
110
+ rubygems_version: 2.4.8
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Fetch App reviews from Google Play.
114
114
  test_files: []
115
+ has_rdoc: