schedule-scraper 0.3.0 → 0.4.0
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.md +13 -4
- data/lib/schedule-scraper/event.rb +11 -0
- data/lib/schedule-scraper/schedule.rb +8 -0
- data/lib/schedule-scraper/version.rb +1 -1
- data/schedule-scraper.gemspec +1 -1
- data/spec/schedule-scraper/pointstreak/event_spec.rb +15 -0
- data/spec/schedule-scraper/pointstreak/schedule_spec.rb +4 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -12,6 +12,8 @@ Supported output formats:
|
|
12
12
|
|
13
13
|
* CSV (straight dump)
|
14
14
|
* Google Calendar formatted CSV
|
15
|
+
* iCal
|
16
|
+
* Yahoo Calendar (via iCal)
|
15
17
|
|
16
18
|
## Installation
|
17
19
|
|
@@ -41,9 +43,9 @@ Locate the printable version of the scheulde:
|
|
41
43
|
Request a schedule:
|
42
44
|
|
43
45
|
url = "http://www.pointstreak.com/players/print/players-team-schedule.html?teamid=385368&seasonid=9162"
|
44
|
-
schedule =
|
46
|
+
schedule = ScheduleScraper.fetch(:pointstreak, url)
|
45
47
|
|
46
|
-
Export the schedule
|
48
|
+
Export the schedule:
|
47
49
|
|
48
50
|
schedule.to_csv
|
49
51
|
|
@@ -51,10 +53,17 @@ or
|
|
51
53
|
|
52
54
|
schedule.to_gcal
|
53
55
|
|
56
|
+
or
|
57
|
+
|
58
|
+
schedule.to_ical
|
59
|
+
|
54
60
|
## TODO
|
55
61
|
|
56
|
-
1. Add
|
57
|
-
|
62
|
+
1. Add other schedule types: ezleagues
|
63
|
+
|
64
|
+
## Why?
|
65
|
+
|
66
|
+
To scratch an itch. I play on a couple of ice hockey teams and the rinks these sites to manage leagues and schedules. These sites do not offer any options for exporing and I got tired of updating my schedule manually every couple of months.
|
58
67
|
|
59
68
|
## Contributing
|
60
69
|
|
@@ -38,6 +38,17 @@ module ScheduleScraper
|
|
38
38
|
event.location ""
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
def to_h
|
43
|
+
{
|
44
|
+
:title => title,
|
45
|
+
:start_date => start_date,
|
46
|
+
:start_time => start_time,
|
47
|
+
:end_date => end_date,
|
48
|
+
:all_day => all_day?,
|
49
|
+
:description => description
|
50
|
+
}
|
51
|
+
end
|
41
52
|
end
|
42
53
|
end
|
43
54
|
|
data/schedule-scraper.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = ScheduleScraper::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency 'nibbler', '~> 1.3.0'
|
19
|
-
gem.add_dependency 'nokogiri', '1.5.4'
|
19
|
+
gem.add_dependency 'nokogiri', '~> 1.5.4'
|
20
20
|
gem.add_dependency 'ri_cal', '~> 0.8.8'
|
21
21
|
|
22
22
|
gem.add_development_dependency 'minitest', '~> 3.1.0'
|
@@ -95,4 +95,19 @@ describe ScheduleScraper::Pointstreak::Event do
|
|
95
95
|
end.must_be_instance_of RiCal::Component::Calendar
|
96
96
|
end
|
97
97
|
end
|
98
|
+
|
99
|
+
describe "#to_h" do
|
100
|
+
it "provides a hash for export" do
|
101
|
+
expected = {
|
102
|
+
:title => subject.title,
|
103
|
+
:start_date => subject.start_date,
|
104
|
+
:start_time => subject.start_time,
|
105
|
+
:end_date => subject.end_date,
|
106
|
+
:all_day => subject.all_day?,
|
107
|
+
:description => subject.description
|
108
|
+
}
|
109
|
+
|
110
|
+
subject.to_h.must_equal expected
|
111
|
+
end
|
112
|
+
end
|
98
113
|
end
|
@@ -35,5 +35,9 @@ describe ScheduleScraper::Pointstreak::Schedule do
|
|
35
35
|
it "generates an ical file" do
|
36
36
|
subject.to_ical.must_be_instance_of RiCal::Component::Calendar
|
37
37
|
end
|
38
|
+
|
39
|
+
it "generates an array of hashes" do
|
40
|
+
subject.to_h.must_be_instance_of Array
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schedule-scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nibbler
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 1.5.4
|
38
38
|
type: :runtime
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 1.5.4
|
46
46
|
- !ruby/object:Gem::Dependency
|