peekapp 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Retrieve reviews and ratings from the App Store.
2
2
 
3
- # Installation
3
+ # Installation
4
4
  gem install peekapp
5
5
 
6
6
  ## How to
@@ -22,7 +22,7 @@ For advanced functionnalities you should read the source. Peekapp can only retri
22
22
  # :user_id => 33308895,
23
23
  # :version => "2.0",
24
24
  # :date => "9-Oct-2009",
25
- # :id => 131605495
25
+ # :id => Digest::SHA256.new("title + username")
26
26
  # }>, ...]
27
27
 
28
28
  # And the ratings...
@@ -5,7 +5,7 @@ module Peekapp
5
5
  def self.query args # {{{
6
6
  c = Curl::Easy.perform(parse_url(args)) do |request|
7
7
  request.headers["User-Agent"] = $peekapp_config[:user_agent]
8
- request.headers["X-Apple-Store-Front"] = "#{args[:store_id]}" if args[:store_id]
8
+ request.headers["X-Apple-Store-Front"] = args[:store_id] if args[:store_id]
9
9
  end
10
10
  c.body_str
11
11
  end # }}}
@@ -45,6 +45,8 @@ module Peekapp
45
45
 
46
46
  class Rating
47
47
 
48
+ attr_accessor :data
49
+
48
50
  def initialize data # {{{
49
51
  @data = data
50
52
  end # }}}
@@ -15,7 +15,7 @@ module Peekapp
15
15
  }
16
16
  dom = Peekapp::query args
17
17
  begin
18
- nb_page = Nokogiri::HTML.parse(dom).css("div.paginated-content").first["total-number-of-pages"].to_i
18
+ nb_page = Nokogiri::HTML.parse(dom).css("div.paginated-content").first["total-number-of-pages"].to_i
19
19
  rescue
20
20
  raise ReviewsUnavailableForThisApp
21
21
  end
@@ -24,7 +24,7 @@ module Peekapp
24
24
  args[:page] = z+1
25
25
  dom = Peekapp::query args if z > 0
26
26
  parse(dom).each do |p|
27
- raise LatestReviewReached if p.id === options[:latest_review_id].to_s
27
+ raise LatestReviewReached if options[:latest_review_hash] and p.id == options[:latest_review_hash]
28
28
  reviews << p
29
29
  end
30
30
  end
@@ -41,7 +41,6 @@ module Peekapp
41
41
  dom.css("div.customer-review").each do |r|
42
42
  # That's some ugly stuff... I know
43
43
  reviews << Review.new({
44
- :id => r.css("a.report").first["href"].split("=").last,
45
44
  :title => r.css("span.customerReviewTitle").children.to_s,
46
45
  :comment => r.css("p.content").children.to_s.gsub("\n", "").gsub(" ", ""),
47
46
  :username => r.css("a.reviewer").children.to_s.gsub("\n", "").gsub(" ", ""),
@@ -62,14 +61,14 @@ module Peekapp
62
61
  @data = data
63
62
  end # }}}
64
63
 
65
- def id # {{{
66
- @data[:id]
67
- end # }}}
68
-
69
64
  def method_missing method # {{{
70
65
  @data[method.to_sym]
71
66
  end # }}}
72
67
 
68
+ def id # {{{
69
+ (Digest::SHA256.new << self.username + self.title).to_s
70
+ end # }}}
71
+
73
72
  end
74
73
 
75
74
  end
@@ -1,3 +1,3 @@
1
1
  module Peekapp
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peekapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 25
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Samuel Garneau
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-17 00:00:00 -05:00
18
+ date: 2011-08-15 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements: []
121
121
 
122
122
  rubyforge_project:
123
- rubygems_version: 1.3.7
123
+ rubygems_version: 1.4.2
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: Retrieve ratings & reviews from the App Store