app_store_reviews 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +6 -0
- data/TODO.md +15 -0
- data/app_store_reviews.gemspec +31 -0
- data/bin/app_store_reviews +20 -0
- data/lib/app_store_reviews.rb +27 -0
- data/lib/app_store_reviews/app.rb +9 -0
- data/lib/app_store_reviews/review.rb +23 -0
- data/lib/app_store_reviews/reviews_request.rb +38 -0
- data/lib/app_store_reviews/store.rb +25 -0
- data/lib/app_store_reviews/stores.rb +82 -0
- data/lib/app_store_reviews/version.rb +3 -0
- data/spec/app_spec.rb +11 -0
- data/spec/app_store_reviews_spec.rb +14 -0
- data/spec/fixtures/reviews.json +78 -0
- data/spec/review_spec.rb +40 -0
- data/spec/reviews_request_spec.rb +13 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/store_spec.rb +19 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ca0195a71b7c8c5f83da0fb14c673595612cd5b
|
4
|
+
data.tar.gz: d2cb9a41bf4e1de22c2ad55ee19ce93f99765b7a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dda4a7f2dc269861e001e8c38510ac2dc999bf323ea499b0a165af068adb391d2d82c5306973799d2338f4a2127671f37bd9b7ca32715b97d8c11023a15086ad
|
7
|
+
data.tar.gz: 80339fd935de07fc8e0ee34505dd0e22cbef25aad50511fd5e4a55a5e097f1bd9e9f44ca0d2153be658cc8a3642361c41f970aa2322c63d8b72fa50478571d0a
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Alexander Greim
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# App Store Reviews
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/iltempo/app_store_reviews.png?branch=master)](https://travis-ci.org/iltempo/app_store_reviews)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/iltempo/app_store_reviews.png)](https://codeclimate.com/github/iltempo/app_store_reviews)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/iltempo/app_store_reviews/badge.png?branch=master)](https://coveralls.io/r/iltempo/app_store_reviews?branch=master)
|
6
|
+
[![Dependency Status](https://gemnasium.com/iltempo/app_store_reviews.png)](https://gemnasium.com/iltempo/app_store_reviews)
|
7
|
+
|
8
|
+
Keep track of your app store reviews.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'app_store_reviews'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install app_store_reviews
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
`app_store_reviews country_name app_id`
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Todo
|
2
|
+
|
3
|
+
* Handle missing params
|
4
|
+
* Handle faulty app ids
|
5
|
+
* Allow custom limit
|
6
|
+
* Test for headers
|
7
|
+
* Find a place for strip html helper method
|
8
|
+
* Find a good place for json parsing
|
9
|
+
* Check require statements
|
10
|
+
* Write readme
|
11
|
+
* Add icon
|
12
|
+
* Release gem
|
13
|
+
* Add documentation
|
14
|
+
* Normalize stores list
|
15
|
+
* Find lightweight alternative to nokogiri
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'app_store_reviews/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'app_store_reviews'
|
8
|
+
spec.version = AppStoreReviews::VERSION
|
9
|
+
spec.author = 'Alexander Greim'
|
10
|
+
spec.email = 'alexxx@iltempo.de'
|
11
|
+
spec.summary = 'Fetching and syncing app store reviews'
|
12
|
+
spec.description = <<-EOF
|
13
|
+
Ruby library for fetching and syncing app store reviews via iTunes json
|
14
|
+
protocol.
|
15
|
+
EOF
|
16
|
+
spec.homepage = 'https://github.com/iltempo/app_store_reviews'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
spec.files = `git ls-files`.split($/)
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.test_files = spec.files.grep(%r{^spec/})
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'httparty', '~> 0.13'
|
25
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
30
|
+
spec.add_development_dependency 'fakeweb', '~> 1.3'
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'app_store_reviews'
|
4
|
+
|
5
|
+
options = {:limit => 5}
|
6
|
+
options[:store] = ARGV[0]
|
7
|
+
options[:app_id] = ARGV[1]
|
8
|
+
|
9
|
+
def print_review(r)
|
10
|
+
puts "| %s [%-5s]" % [ r.title, '*' * r.rating ]
|
11
|
+
puts "| by %s - %s" % [ r.name, r.date.to_date ]
|
12
|
+
r.body.split("\n").each do |line|
|
13
|
+
puts "| %s" % [ line ]
|
14
|
+
end
|
15
|
+
puts
|
16
|
+
end
|
17
|
+
|
18
|
+
AppStoreReviews.get(options).each do |review|
|
19
|
+
print_review(review)
|
20
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'json'
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'httparty'
|
5
|
+
require 'nokogiri'
|
6
|
+
|
7
|
+
require 'app_store_reviews/version'
|
8
|
+
require 'app_store_reviews/stores'
|
9
|
+
require 'app_store_reviews/store'
|
10
|
+
require 'app_store_reviews/app'
|
11
|
+
require 'app_store_reviews/review'
|
12
|
+
require 'app_store_reviews/reviews_request'
|
13
|
+
|
14
|
+
module AppStoreReviews
|
15
|
+
def self.get(opts)
|
16
|
+
store = Store.new(opts[:store])
|
17
|
+
app = App.new(opts[:app_id])
|
18
|
+
json = ReviewsRequest.new(store, app, opts[:limit] || 100).run
|
19
|
+
Review.all_from_json(json)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.strip_html(str)
|
23
|
+
doc = Nokogiri::HTML.parse(str)
|
24
|
+
doc.css('br').each { |node| node.replace("\n") }
|
25
|
+
doc.text
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module AppStoreReviews
|
2
|
+
class Review < OpenStruct
|
3
|
+
def self.new_from_result(data)
|
4
|
+
self.new.tap do |review|
|
5
|
+
review.user_review_id = data['userReviewId']
|
6
|
+
review.title = data['title']
|
7
|
+
review.body = AppStoreReviews.strip_html(data['body'])
|
8
|
+
review.name = data['name']
|
9
|
+
review.rating = data['rating']
|
10
|
+
review.vote_count = data['voteCount']
|
11
|
+
review.vote_sum = data['voteSum']
|
12
|
+
review.date = Time.parse(data['date'])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.all_from_json(json)
|
17
|
+
results = JSON.parse(json)
|
18
|
+
results['userReviewList'].map do |result|
|
19
|
+
new_from_result(result)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module AppStoreReviews
|
2
|
+
class ReviewsRequest
|
3
|
+
include HTTParty
|
4
|
+
base_uri 'https://itunes.apple.com'
|
5
|
+
|
6
|
+
def initialize(store, app, limit)
|
7
|
+
@store = store
|
8
|
+
@app = app
|
9
|
+
@limit = limit
|
10
|
+
set_headers
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
self.class.get(uri_path).body
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def uri_path
|
20
|
+
''.tap do |url|
|
21
|
+
url << '/WebObjects/MZStore.woa/wa/userReviewsRow'
|
22
|
+
url << "?id=#{@app.id}"
|
23
|
+
url << '&displayable-kind=11'
|
24
|
+
url << '&startIndex=0'
|
25
|
+
url << "&endIndex=#{@limit}"
|
26
|
+
url << '&sort=4'
|
27
|
+
url << '&appVersion=all'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_headers
|
32
|
+
self.class.headers({
|
33
|
+
'User-Agent' => 'iTunes/11.1 (Macintosh; OS X 10.9) AppleWebKit/537.71',
|
34
|
+
'X-Apple-Store-Front' => "#{@store.id}-2,17"
|
35
|
+
})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module AppStoreReviews
|
2
|
+
class Store
|
3
|
+
attr_reader :id
|
4
|
+
|
5
|
+
def initialize(store_id_or_country)
|
6
|
+
if store_id_or_country.is_a?(Integer)
|
7
|
+
@id = store_id_or_country
|
8
|
+
elsif store_id_or_country.is_a?(String)
|
9
|
+
@id = resolve_store_id(store_id_or_country)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def resolve_store_id(country)
|
16
|
+
store_data = AppStoreReviews::STORES.detect do |store|
|
17
|
+
store[:country] == country
|
18
|
+
end
|
19
|
+
raise UnknownStore.new("Unknown store for country '#{country}'") unless store_data
|
20
|
+
store_data[:id]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class UnknownStore < StandardError; end
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module AppStoreReviews
|
2
|
+
STORES = [
|
3
|
+
{ :country => 'United States', :id => 143441 },
|
4
|
+
{ :country => 'Argentina', :id => 143505 },
|
5
|
+
{ :country => 'Australia', :id => 143460 },
|
6
|
+
{ :country => 'Belgium', :id => 143446 },
|
7
|
+
{ :country => 'Brazil', :id => 143503 },
|
8
|
+
{ :country => 'Canada', :id => 143455 },
|
9
|
+
{ :country => 'Chile', :id => 143483 },
|
10
|
+
{ :country => 'China', :id => 143465 },
|
11
|
+
{ :country => 'Colombia', :id => 143501 },
|
12
|
+
{ :country => 'Costa Rica', :id => 143495 },
|
13
|
+
{ :country => 'Croatia', :id => 143494 },
|
14
|
+
{ :country => 'Czech Republic', :id => 143489 },
|
15
|
+
{ :country => 'Denmark', :id => 143458 },
|
16
|
+
{ :country => 'Germany', :id => 143443 },
|
17
|
+
{ :country => 'El Salvador', :id => 143506 },
|
18
|
+
{ :country => 'Espana', :id => 143454 },
|
19
|
+
{ :country => 'Finland', :id => 143447 },
|
20
|
+
{ :country => 'France', :id => 143442 },
|
21
|
+
{ :country => 'Greece', :id => 143448 },
|
22
|
+
{ :country => 'Guatemala', :id => 143504 },
|
23
|
+
{ :country => 'Hong Kong', :id => 143463 },
|
24
|
+
{ :country => 'Hungary', :id => 143482 },
|
25
|
+
{ :country => 'India', :id => 143467 },
|
26
|
+
{ :country => 'Indonesia', :id => 143476 },
|
27
|
+
{ :country => 'Ireland', :id => 143449 },
|
28
|
+
{ :country => 'Israel', :id => 143491 },
|
29
|
+
{ :country => 'Italia', :id => 143450 },
|
30
|
+
{ :country => 'Korea', :id => 143466 },
|
31
|
+
{ :country => 'Kuwait', :id => 143493 },
|
32
|
+
{ :country => 'Lebanon', :id => 143497 },
|
33
|
+
{ :country => 'Luxembourg', :id => 143451 },
|
34
|
+
{ :country => 'Malaysia', :id => 143473 },
|
35
|
+
{ :country => 'Mexico', :id => 143468 },
|
36
|
+
{ :country => 'Nederland', :id => 143452 },
|
37
|
+
{ :country => 'New Zealand', :id => 143461 },
|
38
|
+
{ :country => 'Norway', :id => 143457 },
|
39
|
+
{ :country => 'Osterreich', :id => 143445 },
|
40
|
+
{ :country => 'Pakistan', :id => 143477 },
|
41
|
+
{ :country => 'Panama', :id => 143485 },
|
42
|
+
{ :country => 'Peru', :id => 143507 },
|
43
|
+
{ :country => 'Phillipines', :id => 143474 },
|
44
|
+
{ :country => 'Poland', :id => 143478 },
|
45
|
+
{ :country => 'Portugal', :id => 143453 },
|
46
|
+
{ :country => 'Qatar', :id => 143498 },
|
47
|
+
{ :country => 'Romania', :id => 143487 },
|
48
|
+
{ :country => 'Russia', :id => 143469 },
|
49
|
+
{ :country => 'Saudi Arabia', :id => 143479 },
|
50
|
+
{ :country => 'Schweiz/Suisse', :id => 143459 },
|
51
|
+
{ :country => 'Singapore', :id => 143464 },
|
52
|
+
{ :country => 'Slovakia', :id => 143496 },
|
53
|
+
{ :country => 'Slovenia', :id => 143499 },
|
54
|
+
{ :country => 'South Africa', :id => 143472 },
|
55
|
+
{ :country => 'Sri Lanka', :id => 143486 },
|
56
|
+
{ :country => 'Sweden', :id => 143456 },
|
57
|
+
{ :country => 'Taiwan', :id => 143470 },
|
58
|
+
{ :country => 'Thailand', :id => 143475 },
|
59
|
+
{ :country => 'Turkey', :id => 143480 },
|
60
|
+
{ :country => 'United Arab Emirates', :id => 143481 },
|
61
|
+
{ :country => 'United Kingdom', :id => 143444 },
|
62
|
+
{ :country => 'Venezuela', :id => 143502 },
|
63
|
+
{ :country => 'Vietnam', :id => 143471 },
|
64
|
+
{ :country => 'Japan', :id => 143462 },
|
65
|
+
|
66
|
+
# stores added April 1, 2009
|
67
|
+
{ :country => 'Dominican Republic', :id => 143508 },
|
68
|
+
{ :country => 'Ecuador', :id => 143509 },
|
69
|
+
{ :country => 'Egypt', :id => 143516 },
|
70
|
+
{ :country => 'Estonia', :id => 143518 },
|
71
|
+
{ :country => 'Honduras', :id => 143510 },
|
72
|
+
{ :country => 'Jamaica', :id => 143511 },
|
73
|
+
{ :country => 'Kazakhstan', :id => 143517 },
|
74
|
+
{ :country => 'Latvia', :id => 143519 },
|
75
|
+
{ :country => 'Lithuania', :id => 143520 },
|
76
|
+
{ :country => 'Macau', :id => 143515 },
|
77
|
+
{ :country => 'Malta', :id => 143521 },
|
78
|
+
{ :country => 'Moldova', :id => 143523 },
|
79
|
+
{ :country => 'Nicaragua', :id => 143512 },
|
80
|
+
{ :country => 'Paraguay', :id => 143513 }
|
81
|
+
]
|
82
|
+
end
|
data/spec/app_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AppStoreReviews do
|
4
|
+
let(:opts) { { :app_id => 12345, :store_id => 9876 } }
|
5
|
+
subject(:reviews) { AppStoreReviews.get(opts) }
|
6
|
+
|
7
|
+
it 'should have a version number' do
|
8
|
+
expect(AppStoreReviews::VERSION).to_not be_nil
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should return correct number of reviews' do
|
12
|
+
expect(subject.length).to eq(2)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
{
|
2
|
+
"userReviewList": [
|
3
|
+
{
|
4
|
+
"userReviewId": "121212121",
|
5
|
+
"body": "Nice one.",
|
6
|
+
"date": "2013-09-18T05:30:00Z",
|
7
|
+
"name": "one_user",
|
8
|
+
"rating": 5,
|
9
|
+
"title": "Great update",
|
10
|
+
"voteCount": 8,
|
11
|
+
"voteSum": 9,
|
12
|
+
"viewUsersUserReviewsUrl": "https://itunes.apple.com/de/reviews?l=en&userProfileId=121212121",
|
13
|
+
"voteUrl": "https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/rateUserReview?userReviewId=121212121",
|
14
|
+
"reportConcernUrl": "https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/reportAConcernSubmit?cc=de&l=en",
|
15
|
+
"reportConcernExplanation": "Provide more details about this review of 'Whatever'. The author of the review will not be able to see this report.",
|
16
|
+
"customerType": "Customers",
|
17
|
+
"reportConcernReasons": [
|
18
|
+
{
|
19
|
+
"reasonId": "0",
|
20
|
+
"name": "Choose One"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"reasonId": "1",
|
24
|
+
"name": "This review contains offensive material."
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"reasonId": "8",
|
28
|
+
"name": "This review is not a review or is off-topic."
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"reasonId": "9",
|
32
|
+
"name": "I disagree with this review."
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"reasonId": "7",
|
36
|
+
"name": "My concern isn't listed here."
|
37
|
+
}
|
38
|
+
]
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"userReviewId": "232323232",
|
42
|
+
"body": "Looks good.",
|
43
|
+
"date": "2013-09-19T08:20:00Z",
|
44
|
+
"name": "other_user",
|
45
|
+
"rating": 5,
|
46
|
+
"title": "Super!",
|
47
|
+
"voteCount": 0,
|
48
|
+
"voteSum": 0,
|
49
|
+
"viewUsersUserReviewsUrl": "https://itunes.apple.com/de/reviews?l=en&userProfileId=232323232",
|
50
|
+
"voteUrl": "https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/rateUserReview?userReviewId=232323232",
|
51
|
+
"reportConcernUrl": "https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/reportAConcernSubmit?cc=de&l=en",
|
52
|
+
"reportConcernExplanation": "Provide more details about this review of 'Whatever'. The author of the review will not be able to see this report.",
|
53
|
+
"customerType": "Customers",
|
54
|
+
"reportConcernReasons": [
|
55
|
+
{
|
56
|
+
"reasonId": "0",
|
57
|
+
"name": "Choose One"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"reasonId": "1",
|
61
|
+
"name": "This review contains offensive material."
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"reasonId": "8",
|
65
|
+
"name": "This review is not a review or is off-topic."
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"reasonId": "9",
|
69
|
+
"name": "I disagree with this review."
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"reasonId": "7",
|
73
|
+
"name": "My concern isn't listed here."
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
data/spec/review_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module AppStoreReviews
|
4
|
+
describe Review do
|
5
|
+
let(:opts) { { :app_id => 12345, :store_id => 9876 } }
|
6
|
+
subject { AppStoreReviews.get(opts).first }
|
7
|
+
|
8
|
+
it 'should have the user_review_id' do
|
9
|
+
expect(subject.user_review_id).to eq('121212121')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have the title' do
|
13
|
+
expect(subject.title).to eq('Great update')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have the user name' do
|
17
|
+
expect(subject.name).to eq('one_user')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the text' do
|
21
|
+
expect(subject.body).to eq('Nice one.')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should report the rating" do
|
25
|
+
expect(subject.rating).to eq(5)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should report the vote count" do
|
29
|
+
expect(subject.vote_count).to eq(8)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should report the vote sum" do
|
33
|
+
expect(subject.vote_sum).to eq(9)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should report the date" do
|
37
|
+
expect(subject.date.to_date).to eq(Date.new(2013, 9, 18))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module AppStoreReviews
|
4
|
+
describe ReviewsRequest do
|
5
|
+
let(:app) { App.new(12345) }
|
6
|
+
let(:store) { Store.new(9876) }
|
7
|
+
subject { ReviewsRequest.new(store, app, 100) }
|
8
|
+
|
9
|
+
it 'returns json' do
|
10
|
+
expect(JSON.parse(subject.run)).to_not be_empty
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear! if ENV['CI']
|
3
|
+
require 'fakeweb'
|
4
|
+
require 'app_store_reviews'
|
5
|
+
|
6
|
+
FakeWeb.allow_net_connect = %r[^https://coveralls\.io/api]
|
7
|
+
|
8
|
+
reviews_uri ='https://itunes.apple.com/WebObjects/MZStore.woa/wa/userReviewsRow?id=12345&displayable-kind=11&startIndex=0&endIndex=100&sort=4&appVersion=all'
|
9
|
+
FakeWeb.register_uri(:get, reviews_uri, :body => open('spec/fixtures/reviews.json', &:read))
|
data/spec/store_spec.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module AppStoreReviews
|
4
|
+
describe Store do
|
5
|
+
subject { Store }
|
6
|
+
|
7
|
+
it 'has an id' do
|
8
|
+
expect(subject.new(123).id).to eq(123)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'raises if store is not known' do
|
12
|
+
expect {subject.new('Andorra')}.to raise_error(UnknownStore)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'can be initialized with a country name' do
|
16
|
+
expect(subject.new('United States').id).to eq(143441)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: app_store_reviews
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Greim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: fakeweb
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
description: |2
|
98
|
+
Ruby library for fetching and syncing app store reviews via iTunes json
|
99
|
+
protocol.
|
100
|
+
email: alexxx@iltempo.de
|
101
|
+
executables:
|
102
|
+
- app_store_reviews
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".travis.yml"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- TODO.md
|
114
|
+
- app_store_reviews.gemspec
|
115
|
+
- bin/app_store_reviews
|
116
|
+
- lib/app_store_reviews.rb
|
117
|
+
- lib/app_store_reviews/app.rb
|
118
|
+
- lib/app_store_reviews/review.rb
|
119
|
+
- lib/app_store_reviews/reviews_request.rb
|
120
|
+
- lib/app_store_reviews/store.rb
|
121
|
+
- lib/app_store_reviews/stores.rb
|
122
|
+
- lib/app_store_reviews/version.rb
|
123
|
+
- spec/app_spec.rb
|
124
|
+
- spec/app_store_reviews_spec.rb
|
125
|
+
- spec/fixtures/reviews.json
|
126
|
+
- spec/review_spec.rb
|
127
|
+
- spec/reviews_request_spec.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- spec/store_spec.rb
|
130
|
+
homepage: https://github.com/iltempo/app_store_reviews
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.2.2
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: Fetching and syncing app store reviews
|
154
|
+
test_files:
|
155
|
+
- spec/app_spec.rb
|
156
|
+
- spec/app_store_reviews_spec.rb
|
157
|
+
- spec/fixtures/reviews.json
|
158
|
+
- spec/review_spec.rb
|
159
|
+
- spec/reviews_request_spec.rb
|
160
|
+
- spec/spec_helper.rb
|
161
|
+
- spec/store_spec.rb
|