market_bot 0.6.0 → 0.6.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.
- data/README.markdown +29 -8
- data/VERSION +1 -1
- data/lib/market_bot/android/app.rb +1 -1
- data/lib/market_bot/android/leaderboard.rb +1 -1
- data/market_bot.gemspec +1 -1
- data/spec/market_bot/android/leaderboard_spec.rb +1 -0
- metadata +2 -2
data/README.markdown
CHANGED
@@ -13,20 +13,41 @@ Used in production to power [www.droidmeter.com](http://www.droidmeter.com/?t=gi
|
|
13
13
|
|
14
14
|
gem install market_bot
|
15
15
|
|
16
|
-
##
|
16
|
+
## Basic Examples
|
17
17
|
|
18
18
|
require 'rubygems'
|
19
19
|
require 'market_bot'
|
20
20
|
|
21
|
-
# Create a hydra object with 20 http workers.
|
22
|
-
hydra = Typhoeus::Hydra.new(:max_concurrency => 20)
|
23
|
-
|
24
21
|
# Download/parse the leaderboard.
|
25
|
-
lb = MarketBot::Android::Leaderboard.new(:
|
26
|
-
lb.
|
27
|
-
hydra.run
|
22
|
+
lb = MarketBot::Android::Leaderboard.new(:topselling_free, :game)
|
23
|
+
lb.update
|
28
24
|
|
29
25
|
# Download/parse the details for the first and last entries of the leaderboard.
|
26
|
+
first_app = MarketBot::Android::App.new(lb.results.first[:market_id])
|
27
|
+
last_app = MarketBot::Android::App.new(lb.results.last[:market_id])
|
28
|
+
first_app.update
|
29
|
+
last_app.update
|
30
|
+
puts "First place app (#{first_app.title}) price: #{first_app.price}"
|
31
|
+
puts "Last place app (#{last_app.title}) price: #{last_app.price}"
|
32
|
+
|
33
|
+
# Search for apps.
|
34
|
+
sq = MarketBot::Android::SearchQuery.new('donkeys')
|
35
|
+
sq.update
|
36
|
+
puts "Results found: #{sq.results.count}"
|
37
|
+
|
38
|
+
## Advanced Examples
|
39
|
+
|
40
|
+
require 'rubygems'
|
41
|
+
require 'market_bot'
|
42
|
+
|
43
|
+
# Create a reusable hydra object with 5 http workers.
|
44
|
+
hydra = Typhoeus::Hydra.new(:max_concurrency => 5)
|
45
|
+
|
46
|
+
# Download/parse the leaderboard.
|
47
|
+
lb = MarketBot::Android::Leaderboard.new(:topselling_free, :game, :hyda => hydra)
|
48
|
+
lb.update
|
49
|
+
|
50
|
+
# Download/parse the details for the first and last entries of the leaderboard using the batch API.
|
30
51
|
first_app = MarketBot::Android::App.new(lb.results.first[:market_id], :hydra => hydra)
|
31
52
|
last_app = MarketBot::Android::App.new(lb.results.last[:market_id], :hydra => hydra)
|
32
53
|
first_app.enqueue_update
|
@@ -36,7 +57,7 @@ Used in production to power [www.droidmeter.com](http://www.droidmeter.com/?t=gi
|
|
36
57
|
end
|
37
58
|
hydra.run
|
38
59
|
|
39
|
-
#
|
60
|
+
# You must manually check if an error occurred when using the batch API without callbacks.
|
40
61
|
puts "First place app (#{first_app.title}) price: #{first_app.price}" unless first_app.error
|
41
62
|
puts "Last place app (#{last_app.title}) price: #{last_app.price}" unless last_app.error
|
42
63
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
@@ -121,7 +121,7 @@ module MarketBot
|
|
121
121
|
|
122
122
|
def initialize(app_id, options={})
|
123
123
|
@app_id = app_id
|
124
|
-
@hydra = options[:hydra] || Typhoeus::Hydra.
|
124
|
+
@hydra = options[:hydra] || Typhoeus::Hydra.new(:max_concurrency => 5)
|
125
125
|
@callback = nil
|
126
126
|
@error = nil
|
127
127
|
end
|
@@ -66,7 +66,7 @@ module MarketBot
|
|
66
66
|
def initialize(identifier, category=nil, options={})
|
67
67
|
@identifier = identifier
|
68
68
|
@category = category
|
69
|
-
@hydra = options[:hydra] || Typhoeus::Hydra.
|
69
|
+
@hydra = options[:hydra] || Typhoeus::Hydra.new(:max_concurrency => 5)
|
70
70
|
@parsed_results = []
|
71
71
|
end
|
72
72
|
|
data/market_bot.gemspec
CHANGED
@@ -92,6 +92,7 @@ describe 'Leaderboard' do
|
|
92
92
|
context 'Quick API' do
|
93
93
|
stub_hydra(Typhoeus::Hydra.hydra)
|
94
94
|
lb = Leaderboard.new(test_id, test_category)
|
95
|
+
lb.instance_variable_set('@hydra', Typhoeus::Hydra.hydra)
|
95
96
|
lb.update(:min_rank => 1, :max_rank => 96)
|
96
97
|
|
97
98
|
check_results(lb.results)
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -240,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
240
|
version: '0'
|
241
241
|
segments:
|
242
242
|
- 0
|
243
|
-
hash: -
|
243
|
+
hash: -3676727692499242142
|
244
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
245
|
none: false
|
246
246
|
requirements:
|