market_bot 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -55,6 +55,7 @@ namespace :spec do
55
55
  def download(url, save_path)
56
56
  resp = Typhoeus::Request.get(url)
57
57
  File.open(save_path, "w") do |file|
58
+ resp.body.force_encoding('utf-8')
58
59
  file.puts(resp.body)
59
60
  end
60
61
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -15,7 +15,7 @@ module MarketBot
15
15
  doc = Nokogiri::HTML(html)
16
16
 
17
17
  result[:title] = doc.title.gsub(/ - Android Market$/, '')
18
- result[:rating] = doc.css('.doc-metadata').first.elements[2].elements[4].text[6].to_i
18
+ result[:rating] = doc.css('.doc-metadata').first.elements[2].elements[4].text[6]
19
19
  result[:updated] = doc.css('.doc-metadata').first.elements[2].elements[6].text
20
20
  result[:current_version] = doc.css('.doc-metadata').first.elements[2].elements[8].text
21
21
  result[:requires_android] = doc.css('.doc-metadata').first.elements[2].elements[10].text
@@ -16,7 +16,7 @@ module MarketBot
16
16
 
17
17
  unless snippet_node.css('.ratings').empty?
18
18
  stars_text = snippet_node.css('.ratings').first.attributes['title'].value
19
- result[:stars] = /Rating: (.+) stars .*/.match(stars_text)[1].to_i
19
+ result[:stars] = /Rating: (.+) stars .*/.match(stars_text)[1]
20
20
  else
21
21
  result[:stars] = nil
22
22
  end
@@ -0,0 +1,86 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "market_bot"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chad Remesch"]
12
+ s.date = "2011-10-10"
13
+ s.description = "Market Bot is a high performance Ruby scraper for Google's Android Market with a simple to use API. It is built on top of Nokogiri and Typhoeus."
14
+ s.email = "chad@remesch.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "NOTES.txt",
26
+ "README.markdown",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "lib/market_bot.rb",
30
+ "lib/market_bot/android/app.rb",
31
+ "lib/market_bot/android/leaderboard.rb",
32
+ "lib/market_bot/android/leaderboard/constants.rb",
33
+ "market_bot.gemspec",
34
+ "spec/market_bot/android/app_spec.rb",
35
+ "spec/market_bot/android/data/app_1.txt",
36
+ "spec/market_bot/android/data/leaderboard-apps_topselling_paid-page1.txt",
37
+ "spec/market_bot/android/data/leaderboard-apps_topselling_paid-page2.txt",
38
+ "spec/market_bot/android/data/leaderboard-apps_topselling_paid-page3.txt",
39
+ "spec/market_bot/android/data/leaderboard-apps_topselling_paid-page4.txt",
40
+ "spec/market_bot/android/leaderboard_spec.rb",
41
+ "spec/market_bot_spec.rb",
42
+ "spec/spec_helper.rb"
43
+ ]
44
+ s.homepage = "http://github.com/chadrem/market_bot"
45
+ s.licenses = ["MIT"]
46
+ s.require_paths = ["lib"]
47
+ s.rubygems_version = "1.8.10"
48
+ s.summary = "Market Bot: High performance Ruby scraper for Google's Android Market"
49
+
50
+ if s.respond_to? :specification_version then
51
+ s.specification_version = 3
52
+
53
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<typhoeus>, ["~> 0.2.4"])
55
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.5.0"])
56
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
57
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
59
+ s.add_development_dependency(%q<rcov>, [">= 0"])
60
+ s.add_development_dependency(%q<ZenTest>, ["~> 4.6.2"])
61
+ s.add_development_dependency(%q<ruby-debug19>, [">= 0.11.6"])
62
+ s.add_development_dependency(%q<rdoc>, [">= 3.9.4"])
63
+ else
64
+ s.add_dependency(%q<typhoeus>, ["~> 0.2.4"])
65
+ s.add_dependency(%q<nokogiri>, ["~> 1.5.0"])
66
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
67
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
68
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
69
+ s.add_dependency(%q<rcov>, [">= 0"])
70
+ s.add_dependency(%q<ZenTest>, ["~> 4.6.2"])
71
+ s.add_dependency(%q<ruby-debug19>, [">= 0.11.6"])
72
+ s.add_dependency(%q<rdoc>, [">= 3.9.4"])
73
+ end
74
+ else
75
+ s.add_dependency(%q<typhoeus>, ["~> 0.2.4"])
76
+ s.add_dependency(%q<nokogiri>, ["~> 1.5.0"])
77
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
78
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
79
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
80
+ s.add_dependency(%q<rcov>, [">= 0"])
81
+ s.add_dependency(%q<ZenTest>, ["~> 4.6.2"])
82
+ s.add_dependency(%q<ruby-debug19>, [">= 0.11.6"])
83
+ s.add_dependency(%q<rdoc>, [">= 3.9.4"])
84
+ end
85
+ end
86
+
@@ -8,7 +8,7 @@ test_src_data = read_file(File.dirname(__FILE__), 'data', 'app_1.txt')
8
8
  def check_getters(app)
9
9
  it 'should populate the getters' do
10
10
  app.title.should == 'Pop Dat'
11
- app.rating.should == 4
11
+ app.rating.should == '4'
12
12
  app.updated.should == 'August 27, 2011'
13
13
  app.current_version.should == '1.0'
14
14
  app.requires_android.should == '2.2 and up'
@@ -44,7 +44,7 @@ describe 'App' do
44
44
  result = App.parse(test_src_data)
45
45
 
46
46
  result[:title].should == 'Pop Dat'
47
- result[:rating].should == 4
47
+ result[:rating].should == '4'
48
48
  result[:updated].should == 'August 27, 2011'
49
49
  result[:current_version].should == '1.0'
50
50
  result[:requires_android].should == '2.2 and up'
@@ -26,7 +26,8 @@ def check_results(results)
26
26
  app.keys.sort.should == [:developer, :market_id, :market_url, :price_usd, :stars, :title]
27
27
  app[:market_url].should == App.new(app[:market_id]).market_url
28
28
  app[:price_usd].should =~ /^\$\d+\.\d{2}$/
29
- [0, 1, 2, 3, 4].should include(app[:stars])
29
+ app[:stars].to_f.should > 0.0
30
+ app[:stars].to_f.should <= 5.0
30
31
  end
31
32
  end
32
33
 
@@ -35,7 +36,7 @@ def check_results(results)
35
36
  results.first[:market_id].should == 'com.zeptolab.ctr.paid'
36
37
  results.first[:market_url].should == 'https://market.android.com/details?id=com.zeptolab.ctr.paid'
37
38
  results.first[:price_usd].should == '$0.99'
38
- results.first[:stars].should == 4
39
+ results.first[:stars].should == '4.6'
39
40
  results.first[:title].should == 'Cut the Rope'
40
41
  end
41
42
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: market_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-08 00:00:00.000000000Z
12
+ date: 2011-10-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
16
- requirement: &70215966452960 !ruby/object:Gem::Requirement
16
+ requirement: &70320572409040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70215966452960
24
+ version_requirements: *70320572409040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70215966451920 !ruby/object:Gem::Requirement
27
+ requirement: &70320572408560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.5.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70215966451920
35
+ version_requirements: *70320572408560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70215966450880 !ruby/object:Gem::Requirement
38
+ requirement: &70320572408080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.3.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70215966450880
46
+ version_requirements: *70320572408080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70215966449560 !ruby/object:Gem::Requirement
49
+ requirement: &70320572423960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70215966449560
57
+ version_requirements: *70320572423960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70215966448500 !ruby/object:Gem::Requirement
60
+ requirement: &70320572423480 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70215966448500
68
+ version_requirements: *70320572423480
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70215966447640 !ruby/object:Gem::Requirement
71
+ requirement: &70320572423000 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70215966447640
79
+ version_requirements: *70320572423000
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: ZenTest
82
- requirement: &70215966446720 !ruby/object:Gem::Requirement
82
+ requirement: &70320572422520 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 4.6.2
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70215966446720
90
+ version_requirements: *70320572422520
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: ruby-debug19
93
- requirement: &70215966445680 !ruby/object:Gem::Requirement
93
+ requirement: &70320572422040 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.11.6
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70215966445680
101
+ version_requirements: *70320572422040
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rdoc
104
- requirement: &70215966444660 !ruby/object:Gem::Requirement
104
+ requirement: &70320572421560 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 3.9.4
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70215966444660
112
+ version_requirements: *70320572421560
113
113
  description: Market Bot is a high performance Ruby scraper for Google's Android Market
114
114
  with a simple to use API. It is built on top of Nokogiri and Typhoeus.
115
115
  email: chad@remesch.com
@@ -132,6 +132,7 @@ files:
132
132
  - lib/market_bot/android/app.rb
133
133
  - lib/market_bot/android/leaderboard.rb
134
134
  - lib/market_bot/android/leaderboard/constants.rb
135
+ - market_bot.gemspec
135
136
  - spec/market_bot/android/app_spec.rb
136
137
  - spec/market_bot/android/data/app_1.txt
137
138
  - spec/market_bot/android/data/leaderboard-apps_topselling_paid-page1.txt
@@ -156,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
157
  version: '0'
157
158
  segments:
158
159
  - 0
159
- hash: 2844818359856846259
160
+ hash: 3498172582817055283
160
161
  required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  none: false
162
163
  requirements: