schedule-scraper 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -2
- data/lib/schedule-scraper/event.rb +6 -3
- data/lib/schedule-scraper/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -65,14 +65,19 @@ or
|
|
65
65
|
|
66
66
|
schedule.to_ical
|
67
67
|
|
68
|
-
|
68
|
+
You can also skip passing the schedule type and just supply a valid URL:
|
69
69
|
|
70
|
-
|
70
|
+
url = "http://pinevilleice.ezleagues.ezfacility.com/teams/1026121/The-Schwartz.aspx"
|
71
|
+
schedule = ScheduleScraper.fetch(url)
|
71
72
|
|
72
73
|
## Why?
|
73
74
|
|
74
75
|
To scratch an itch. I play on a couple of ice hockey teams and the rinks use 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.
|
75
76
|
|
77
|
+
## Add Other Schedule Sypes
|
78
|
+
|
79
|
+
The heart of this gem is wrapping the [nibbler](https://github.com/mislav/nibbler) gem. If you'd like to add another schedule type you'll need to add a namespaced Schedule and Event class that knows how to parse the calendar in question.
|
80
|
+
|
76
81
|
## Contributing
|
77
82
|
|
78
83
|
1. Fork it
|
@@ -47,7 +47,6 @@ module ScheduleScraper
|
|
47
47
|
# end
|
48
48
|
|
49
49
|
def start_date_time
|
50
|
-
|
51
50
|
DateTime.strptime "#{start_date} #{start_time}", '%m/%d/%y %H:%M %P'
|
52
51
|
end
|
53
52
|
|
@@ -56,6 +55,10 @@ module ScheduleScraper
|
|
56
55
|
start_date_time.to_time + 3600
|
57
56
|
end
|
58
57
|
|
58
|
+
def date_time_string(dt)
|
59
|
+
dt.strftime "%Y%m%dT%H%M%S"
|
60
|
+
end
|
61
|
+
|
59
62
|
def private?
|
60
63
|
true
|
61
64
|
end
|
@@ -83,8 +86,8 @@ module ScheduleScraper
|
|
83
86
|
def to_ical(cal)
|
84
87
|
cal.event do |event|
|
85
88
|
event.summary description
|
86
|
-
event.dtstart start_date_time
|
87
|
-
event.dtend end_date_time
|
89
|
+
event.dtstart date_time_string(start_date_time)
|
90
|
+
event.dtend date_time_string(end_date_time)
|
88
91
|
event.location ""
|
89
92
|
end
|
90
93
|
end
|
data/spec/spec_helper.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.1
|
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-07-
|
12
|
+
date: 2012-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nibbler
|
@@ -211,3 +211,4 @@ test_files:
|
|
211
211
|
- spec/spec_helper.rb
|
212
212
|
- spec/vcr_cassettes/schwartz_summer_2012.yml
|
213
213
|
- spec/vcr_cassettes/summit_summer_2012.yml
|
214
|
+
has_rdoc:
|