bnet_scraper 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -1
- data/bnet_scraper.gemspec +1 -1
- data/lib/bnet_scraper/starcraft2.rb +10 -0
- data/lib/bnet_scraper/starcraft2/base_scraper.rb +5 -0
- data/spec/starcraft2_spec.rb +12 -0
- data/spec/support/shared/sc2_scraper.rb +14 -0
- metadata +14 -14
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# Changelog!
|
2
2
|
|
3
|
+
## 0.1.1 (Jul 20 2012)
|
4
|
+
|
5
|
+
* Adds BnetScraper::Starcraft2.valid\_profile?
|
6
|
+
* Adds BnetScraper::Starcraft2::BaseScraper#valid?
|
7
|
+
|
3
8
|
## 0.1.0 (Jul 06 2012)
|
4
9
|
|
5
10
|
* Replaces open-uri with Faraday
|
6
11
|
* Adds BnetScraper::InvalidProfileError when unsuccessfully scraping
|
7
12
|
|
8
|
-
## 0.2
|
13
|
+
## 0.0.2 (Apr 20 2012)
|
9
14
|
|
10
15
|
* Adds Battle.net Status API
|
11
16
|
* Adds Match History scraping
|
data/bnet_scraper.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "bnet_scraper"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.1"
|
7
7
|
s.authors = ["Andrew Nordman"]
|
8
8
|
s.email = ["anordman@majorleaguegaming.com"]
|
9
9
|
s.homepage = "https://github.com/agoragames/bnet_scraper/"
|
@@ -43,5 +43,15 @@ module BnetScraper
|
|
43
43
|
profile_output[:leagues] = parsed_leagues
|
44
44
|
return profile_output
|
45
45
|
end
|
46
|
+
|
47
|
+
# Determine if Supplied profile is valid. Useful for validating now before an
|
48
|
+
# async scraping later
|
49
|
+
#
|
50
|
+
# @param [Hash] options - account information hash
|
51
|
+
# @return [TrueClass, FalseClass] valid - whether account is valid
|
52
|
+
def self.valid_profile? options
|
53
|
+
scraper = BaseScraper.new(options)
|
54
|
+
scraper.valid?
|
55
|
+
end
|
46
56
|
end
|
47
57
|
end
|
data/spec/starcraft2_spec.rb
CHANGED
@@ -29,4 +29,16 @@ describe BnetScraper::Starcraft2 do
|
|
29
29
|
actual.should == expected
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
describe '#valid_profile?' do
|
34
|
+
it 'should return true on valid profile' do
|
35
|
+
result = BnetScraper::Starcraft2.valid_profile? url: 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/'
|
36
|
+
result.should be_true
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return false on invalid profile' do
|
40
|
+
result = BnetScraper::Starcraft2.valid_profile? url: 'http://us.battle.net/sc2/en/profile/2377239/1/SomeDude/'
|
41
|
+
result.should be_false
|
42
|
+
end
|
43
|
+
end
|
32
44
|
end
|
@@ -69,4 +69,18 @@ shared_examples 'an SC2 Scraper' do
|
|
69
69
|
subject.profile_url(2).should == 'http://us.battle.net/sc2/en/profile/2377239/2/Demon/'
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
describe '#valid?' do
|
74
|
+
it 'should return true when profile is valid' do
|
75
|
+
result = subject.valid?
|
76
|
+
result.should be_true
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should return false when profile is invalid' do
|
80
|
+
scraper = scraper_class.new(url: 'http://us.battle.net/sc2/en/profile/2377239/1/SomeDude/')
|
81
|
+
|
82
|
+
result = scraper.valid?
|
83
|
+
result.should be_false
|
84
|
+
end
|
85
|
+
end
|
72
86
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bnet_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
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: 2012-07-
|
12
|
+
date: 2012-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70293725815740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70293725815740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &70293725814020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70293725814020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70293725811160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70293725811160
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70293725810060 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70293725810060
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: fakeweb
|
60
|
-
requirement: &
|
60
|
+
requirement: &70293725809160 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70293725809160
|
69
69
|
description: BnetScraper is a Nokogiri-based scraper of Battle.net profile information.
|
70
70
|
Currently this only includes Starcraft2.
|
71
71
|
email:
|
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
segments:
|
125
125
|
- 0
|
126
|
-
hash:
|
126
|
+
hash: -3598619237861555202
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
segments:
|
134
134
|
- 0
|
135
|
-
hash:
|
135
|
+
hash: -3598619237861555202
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
138
|
rubygems_version: 1.8.17
|