bnet_scraper 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/bnet_scraper.gemspec +1 -1
- data/lib/bnet_scraper/starcraft2/base_scraper.rb +9 -5
- data/spec/starcraft2/base_scraper_spec.rb +6 -0
- metadata +14 -14
data/CHANGELOG.md
CHANGED
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.3.
|
6
|
+
s.version = "0.3.1"
|
7
7
|
s.authors = ["Andrew Nordman"]
|
8
8
|
s.email = ["anordman@majorleaguegaming.com"]
|
9
9
|
s.homepage = "https://github.com/agoragames/bnet_scraper/"
|
@@ -20,11 +20,15 @@ module BnetScraper
|
|
20
20
|
def initialize options = {}
|
21
21
|
if options[:url]
|
22
22
|
extracted_data = options[:url].match(/http:\/\/(.+)\/sc2\/(.+)\/profile\/(.+)\/(\d{1})\/(.[^\/]+)\//)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
if extracted_data
|
24
|
+
@region = REGION_DOMAINS[extracted_data[1]]
|
25
|
+
@bnet_id = extracted_data[3]
|
26
|
+
@bnet_index = extracted_data[4]
|
27
|
+
@account = extracted_data[5]
|
28
|
+
@url = options[:url]
|
29
|
+
else
|
30
|
+
raise BnetScraper::InvalidProfileError, "URL provided does not match Battle.net format"
|
31
|
+
end
|
28
32
|
elsif options[:bnet_id] && options[:account]
|
29
33
|
@bnet_id = options[:bnet_id]
|
30
34
|
@account = options[:account]
|
@@ -6,6 +6,12 @@ describe BnetScraper::Starcraft2::BaseScraper do
|
|
6
6
|
let(:subject) { scraper_class.new(url: 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/') }
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'raises InvalidProfileError on poorly formatted URL' do
|
10
|
+
expect {
|
11
|
+
BnetScraper::Starcraft2::BaseScraper.new url: 'mangled_url'
|
12
|
+
}.to raise_error BnetScraper::InvalidProfileError
|
13
|
+
end
|
14
|
+
|
9
15
|
describe '#scrape' do
|
10
16
|
it 'should raise an error calling scrape' do
|
11
17
|
expect { subject.scrape }.to raise_error NotImplementedError
|
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.3.
|
4
|
+
version: 0.3.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-09-
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70113957192020 !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: *70113957192020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &70113957191500 !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: *70113957191500
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70113957190940 !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: *70113957190940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70113957190320 !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: *70113957190320
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: fakeweb
|
60
|
-
requirement: &
|
60
|
+
requirement: &70113957189160 !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: *70113957189160
|
69
69
|
description: BnetScraper is a Nokogiri-based scraper of Battle.net profile information.
|
70
70
|
Currently this only includes Starcraft2.
|
71
71
|
email:
|
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
segments:
|
129
129
|
- 0
|
130
|
-
hash:
|
130
|
+
hash: 1434413349311613347
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
none: false
|
133
133
|
requirements:
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
segments:
|
138
138
|
- 0
|
139
|
-
hash:
|
139
|
+
hash: 1434413349311613347
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
142
|
rubygems_version: 1.8.17
|